Mindmap
Making Our Own Types and Typeclasses
Inhalt der Mindmap
Making Our Own Types and Typeclasses
Algebraic data types intro
- module
- functions between commas
- ending with,where
- module
Record syntax
- Create a data type that decribes something and stores it
- example
- information of a person(name,lastname,age,gender,etc)
- example
- Create a data type that decribes something and stores it
Type parameters
- A value constructor can take some values parameters and then produce a new value
- type constructors can take types as parameters to produce new types
Derived instances
- Derive other functions to use in a data type
Type synonyms
- types that are equivalent
- Example
- type Phone=String then Phone and String are the same
- Example
- types that are equivalent
Recursive data structures
- we can make types whose constructors have fields that are of the same type! Using that, we can create recursive data types, where one value of some type contains values of that type, which in turn contain more values of the same type and so on
Typeclasses 102
- typeclasses are like interfaces. A typeclass defines some behavior (like comparing for equality, comparing for ordering, enumeration) and then types that can behave in that way are made instances of that typeclass
- yes-no Typeclasses
- It is similar to the if,else conditionals in java
Informationen
- Beschreibung
- Mindmap am Making Our Own Types and Typeclasses, erstellt von ESGUERRA TAVERA CARLOS JOSE am 20/09/2019.
- Erstellt von
- ESGUERRA TAVERA CARLOS JOSE · Sep 2019
- Aktualisiert
- 20 Sep 2019
- Aufrufe
- 0
- Bewertung
Mehr zu Data Types and Typeclasses