¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Haskell Modules

Nicolas Rubiano Inglés

Contenido del mapa

Haskell Modules

  1. We need to import the modules before we can use it.

    • How?
      • Using the keyword: import MyModule
        • import Data.List
          • After import the module Data.List all the functions in that package will be available to us.
  2. Also we can import the functions needed in a module.

    • import Data.List(nub)
      • On the other way around we can hide some function from the namespace
        • import Data.List hiding nub
  3. Sometimes we can have conflicts with function form diferents modules with the same same so in tha case we need to reference it with a qualified indentifier

    • import qualified Data.Map
      • Other way to do an import is
        • import qualified Data.Map as M
          • We are using M as alias to call the function in the module Data.Map
  4. Build in Modules

    • Data.List
      • Functions related with lists.
    • Data.Char
      • Functions to deal with chars
    • Data.Map
      • Function to deal with key value pair where the order doesn't matter
    • Data.Set
      • Functions to deal with Sets, contains unique elements and they are ordered.
  5. How to define our own Modules

    • As a good practice is better to group functions related to put it in the same module.
      • module Geometry ( sphereVolume ) where
        • module Geometry ( sphereVolume ) where sphereVolume :: Float -> Float sphereVolume radius = (4.0 / 3.0) * pi * (radius ^ 3)
          • We must put the Geometry.hs in the same path of the main module in order to import it in the running module.

Información

Descripción
Mapa Mental sobre Haskell Modules, creado por Nicolas Rubiano el 22/09/2018.
Creado por
Nicolas Rubiano
Visitas
0
Valoración

Más sobre Haskell Modules and Libraries

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?