Mapa mental
Make our own Types and Typeclasses

Contenido del mapa
Make our own Types and Typeclasses
Word "data"
- Allow us to define a new data type
- Syntaxis
- data "data_name" = "values" | "value2"
- The "|" is an or
- Both the type name and the value constructors have to be capital cased.
- Value constructors
- Are functions that return some data type
- data "data_name" = "value_constructor_name" "parameter1" "parametern" | "value_constructor_name" "parameter1" "parametern"
- We can operate over a value consctructor because is a function
- Define the parameter of a type more generic, allow us to make the parameter of any type
- Are functions that return some data type
- data "data_name" = "values" | "value2"
- Syntaxis
- Allow us to define a new data type
Defining types and typeclasses in a module
- We define types like
- "data_name"(..)
- We can omit some value constructors
- "data_name"
- Import some specifics values constructors
- "data_name"("value1", "valueN")
- We define types like
Record syntax
- Allow us to define a "name" to all the values of a type
- Allow us to define a "name" to all the values of a type
Type parameters
Deriving
- Make our data type inherit some behaviour of some typeclass
Type synonym
- GIve other name to any data type
- type "name" = "data_type_name"
- type "name" = "data_type_name"
- GIve other name to any data type
Recurisive data structures
- We can define value constructors that can have the same data type that we are defining
Make typeclasses
- Syntax
- class 'Typeclass_name' 'type_value' where
- The 'type_value' has to be a concrete type
- class 'Typeclass_name' 'type_value' where
- Functor typeclass
- Things that can be mapped over
- Syntax
Imágenes y archivos del mapa
Información
- Descripción
- Ingeniería Mapa Mental sobre Make our own Types and Typeclasses, creado por WILLIAM SANTIAGO FONSECA MORA el 24/09/2021.
- Creado por
- WILLIAM SANTIAGO FONSECA MORA
- Visitas
- 0
- Valoración
Más sobre Data Types and Typeclasses


