Mapa mental
Modules
Conteúdo do mapa
Modules
are a collection of related functions, types and typeclasses
- in the same way, a Haskell program is a collection of modules.
There's a module for manipulating lists, a module for concurrent programming, a module for dealing with complex numbers, etc
The syntax for importing modules in a Haskell script is: import <module name>.
- Data.List
- It provides some very useful functions for dealing with list.
- intersperse, intercalate, transpose, concat, elemIndex ...
- function we could find once we import Data.List
- intersperse, intercalate, transpose, concat, elemIndex ...
- It provides some very useful functions for dealing with list.
- Data.Char
- functions that deal with characters. It's also helpful when filtering and mapping over strings because they're just lists of characters
- isControl, isSpace, isLower, isUpper, isAlpha, isAlphaNum, isDigit ...
- function we could find once we import Data.Char
- isControl, isSpace, isLower, isUpper, isAlpha, isAlphaNum, isDigit ...
- functions that deal with characters. It's also helpful when filtering and mapping over strings because they're just lists of characters
- Data.Map
- are lists that are used to store key-value pairs where ordering doesn't matter.
- fromList , empty, insert , null, size, singleton, lookup ...
- function we could find once we import Data.Map
- fromList , empty, insert , null, size, singleton, lookup ...
- are lists that are used to store key-value pairs where ordering doesn't matter.
- sometimes function shared common functions
- to solve this we make the import qualified asigning a alias for each function
- import qualified Geometry.Sphere as Sphere
- to solve this we make the import qualified asigning a alias for each function
- Data.List
Making our own modules
- At the beginning of a module, we specify the module name
- Then, we specify the functions that it exports
- suroounded by () and each function separated by ,
- after that, we can start writing the functions
- after where definition.
Informações
- Descrição
- Mapa Mental sobre Modules, criado por sixto alberto becerra reslen em 27-03-2020.
- Criado por
- sixto alberto becerra reslen
- Visualizações
- 1
- Avaliação
Mais sobre Haskell Modules and Libraries