Mapa mental
Making Our Own Types and Typeclasses
Conteúdo do mapa
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
Informações
- Descrição
- Mapa Mental sobre Making Our Own Types and Typeclasses, criado por ESGUERRA TAVERA CARLOS JOSE em 20-09-2019.
- Criado por
- ESGUERRA TAVERA CARLOS JOSE · set 2019
- Atualizado
- 20 set 2019
- Visualizações
- 0
- Avaliação
Mais sobre Data Types and Typeclasses