Mindmap
Making our own types and typeclasses
Inhalt der Mindmap
Making our own types and typeclasses
Record Syntaxis
- Make datatypes more easy to read
- It´s declarated as as it was an "list"
- data <name> = <name> {FirstParameter :: <type>, second :: <type> , ...} deriving { ... }
- Haskell automatically creates the functions for firstparameter and the others
- data <name> = <name> {FirstParameter :: <type>, second :: <type> , ...} deriving { ... }
- It´s declarated as as it was an "list"
- Make datatypes more easy to read
Type Parameters
- Nothing Just
- Maybe
- Type constructor takes a type to produce a new type
- is useful when the type stored doesn't really mater too much
- At the end the functions will be defined for an specific type
- is useful when the type stored doesn't really mater too much
Type Synonymus
- Gives types different names so that they make more sense to someone reading our code and documentation
- Word type defines a synonym for an existing type
- Either : Tell us about fails
- Deescribe what some existing type represents ir our functions
Recursive Data Structures
- One value of some type contains values of that type
- Conatin more values of the same types
- Make types that have themselves as type in their fields
- One value of some type contains values of that type
Algebraic data types
- Data keyword define a type
- Boolean comparisons
- Value constructor are functions
- deriving(show)
- Export the functions and type
- Modules
- Data keyword define a type
derived instaces
- Haskell will see if the value constructors match
- Show and read type classes are for things that can be converted to or from strings
Informationen
- Beschreibung
- Mindmap am Making our own types and typeclasses, erstellt von Jose Luis Vega am 17/09/2018.
- Erstellt von
- Jose Luis Vega
- Aufrufe
- 0
- Bewertung
Mehr zu Data Types and Typeclasses