Mapa mental
Making Our Own Types and Typeclasses
Conteúdo do mapa
Making Our Own Types and Typeclasses
Algebraic data types intro
Record syntax
- This topic refers to how to define structures in Haskell
- data Person = Person { firstName :: String , lastName :: String , age :: Int , height :: Float , phoneNumber :: String , flavor :: String } deriving (Show)
- This topic refers to how to define structures in Haskell
Type parameters
- We can generate new types using type constructors.
- data Maybe a = Nothing | Just a
- We can generate new types using type constructors.
Derived instances
- We can add behaviour to our structures, like other typeclasses.
- data Person = Person { firstName :: String , lastName :: String , age :: Int } deriving (Eq)
- We can add behaviour to our structures, like other typeclasses.
Type synonyms
- As the name says we can add synonyms to some types to make more readable, depending the code context.
- type String = [Char]
- As the name says we can add synonyms to some types to make more readable, depending the code context.
Typeclasses 102
A yes-no typeclass
- could be a function that defines
Informações
- Descrição
- Mapa Mental sobre Making Our Own Types and Typeclasses, criado por Nicolas Rubiano em 22-09-2018.
- Criado por
- Nicolas Rubiano
- Visualizações
- 0
- Avaliação
Mais sobre Data Types and Typeclasses