Mindmap
Making Our Own Types and Typeclasses
Inhalt der Mindmap
Making Our Own Types and Typeclasses
Algebraic data types intro
Data
- defining a new data type
|
- Constructor
deriving
module
- write funcions between commas
- Ending with, where
- write funcions between commas
Record syntax
- we've been tasked with creating a data type that describes a person. The info that we want to store about that person is: first name, last name, age, height, phone number, and favorite ice-cream flavor.
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
- typeclass is a sort of an interface that defines some behavior
- A type can be made an instance of a typeclass if it supports that behavior
Type synonyms
- types are equivalent and interchangeable
- ype synonyms don't really do anything per se, they're just about giving some types different names so that they make more sense to someone reading our code and documentatio
Recursive data structures
- a constructor in an algebraic data type can have several (or none at all) fields and each field must be of some concrete type. With that in mind
Informationen
- Beschreibung
- Mindmap am Making Our Own Types and Typeclasses, erstellt von JUAN DAVID PARDO REINA am 30/03/2019.
- Erstellt von
- JUAN DAVID PARDO REINA
- Aufrufe
- 0
- Bewertung
Mehr zu Data Types and Typeclasses