Mapa mental
Making your own data types and typeclasses
Conteúdo do mapa
Making your own data types and typeclasses
Algebraic data types
- We can use the keyword data to make our own data types, also we can use the keyword deriving (show) to make the type part of the Show typeclass
Record Sintax
- We can create whatever object we want with an sintax that is pretty similar to the sintax of the data in the modules
Type parameters
- We can also use parameters of any type in the construction of any object, using all the previous concepts we can create an even more generic object.
Derived instances
- Derived instances are like addons that can be added to our objects, so they can be some sort of things, like for example if we derive Eq we can compare, if we derive Show we can print, etc...
Typeclasses
- We can create our own typleclasses using the keyword class and creating our own rules for the typeclass
Functor Typeclass
- The functor typeclass can be used like the map function, but in this case the list can have any type of data, and the function will be applied in the corresponding data type that can be applied.
Informações
- Descrição
- Mapa Mental sobre Making your own data types and typeclasses, criado por Santiago Cárdenas em 27-03-2019.
- Criado por
- Santiago Cárdenas
- Visualizações
- 0
- Avaliação
Mais sobre Data Types and Typeclasses