Mind map
Chapter 7: Modules
Map content
Chapter 7: Modules
Data.List
- The Prelude module exports some functions from Data.List for convenience
- It provides some very useful functions for dealing with lists.
- You don't have to import Data.List via a qualified import because it doesn't clash with any Prelude names
Load Moduies
- You can choose to import all the module or only some functions
- Import quialified allows you to differantiate functions with the same name putting the module name before the funciton
- All the functions that the module exports become available in the global namespace
- The syntax for importing modules is import <import module name>
Data.Char
- It exports functions that deal with characters
- It's also helpful when filtering and mapping over strings because they're just lists of characters
Data.Map
- Association lists (also called dictionaries) are lists that are used to store key-value pairs where ordering doesn't matter
- Offers association lists that are much faster (because they're internally implemented with trees) and also it provides a lot of utility functions
- exports functions that clash with the Prelude and Data.List ones, we'll do a qualified import.
Dta.Set
- They're internally implemented with trees
- All the elements in a set are unique
- clash with a lot of Prelude and Data.List names, we do a qualified import.
- The most common operation when dealing with sets are inserting into a set, checking for membership and converting a set to a list
Making our own modules
- The name of the file .hs needs to be the name of the module
- After creating the file we need to specify the functions that it exports
- After specifing the funtions we put a where and define the functions
- export only those functions that act as a sort of interface to our module so that the implementation is hidden
- Ffunctions that serve some common purpose you can put them in their own module.
Information
- Description
- Mind Map on Chapter 7: Modules, created by DANIELA ABALLAY GARCIA on 29/03/2022.
- Created by
- DANIELA ABALLAY GARCIA
- Views
- 0
- Rating