GoConqr has a new look! Let us know what you think.

Mind map

Haskell Modules

Nicolas Rubiano English

Map content

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.

Information

Description
Mind Map on Haskell Modules, created by Nicolas Rubiano on 22/09/2018.
Created by
Nicolas Rubiano
Views
0
Rating

More on Haskell Modules and Libraries

Feedback

What is it about?

What do you think of the new look?

How do you like it?