GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Haskell Modules

Nicolas Rubiano Englisch

Inhalt der Mindmap

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.

Informationen

Beschreibung
Mindmap am Haskell Modules, erstellt von Nicolas Rubiano am 22/09/2018.
Erstellt von
Nicolas Rubiano
Aufrufe
0
Bewertung

Mehr zu Haskell Modules and Libraries

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck