Mapa mental
Chapter 8 - Making Our Own Types and Typeclasses
Contenido del mapa
Chapter 8 - Making Our Own Types and Typeclasses
Algebraic data types intro
- For the creation of a type is the word "data"
- For example, the bool type is defined the following way:
- data Bool = False | True
- For example, the bool type is defined the following way:
- For the creation of a type is the word "data"
Record syntax
- Similar to the creation of a POO object
- data Person = Person String String Int Float String String deriving (Show)
- Similar to the creation of a POO object
Type parameters
- Data builders and type they can take parameters and produce a new value.
Type synonyms
- They are a way of defining that 2 types are equal and interchangeable, for example:
- type String = [Char]
- They are a way of defining that 2 types are equal and interchangeable, for example:
A yes-no typeclass
- Define a function
- This function takes a value of any kind that can express some truth value and tells us if it is true or not.
- Define a function
Kinds and some type-foo
- We talk about type constructors take other types as parameters and end up producing specific types
- Like the functions that take values as parameters and return value
- We talk about type constructors take other types as parameters and end up producing specific types
Información
- Descripción
- Mapa Mental sobre Chapter 8 - Making Our Own Types and Typeclasses, creado por Jesús Henríquez el 23/09/2018.
- Creado por
- Jesús Henríquez
- Visitas
- 0
- Valoración
Más sobre Data Types and Typeclasses