Mind map
Making Our Own Types and Typeclasses
Map content
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
Information
- Description
- Mind Map on Making Our Own Types and Typeclasses, created by JUAN DAVID PARDO REINA on 30/03/2019.
- Created by
- JUAN DAVID PARDO REINA
- Views
- 0
- Rating
More on Data Types and Typeclasses