Mindmap
Making (types)classes
Inhalt der Mindmap
Making (types)classes
wanna a new type?
- data datatype_name = <value constructors>
- value constructors specify the different values that this type can have.
- that could be printed in the prompt?
- data datatype_name = <value constructors> deriving (Show)
- data datatype_name = <value constructors>
want to create a function to get separate info from a type?
- example: firstName of a Person
- firstName :: Person -> String firstName (Person firstname _ _ _ _ _) = firstname
- example: firstName of a Person
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
- 1. make our data type
- 2.think about what it can act like
- 1. make our data type
Type synonims
- types equivalent and interchangeable
- usign type keyword
- type String = [Char]
- usign type keyword
- types equivalent and interchangeable
Functors
- typeclass
- for things that can be mapped over
- typeclass
Informationen
- Beschreibung
- Mindmap am Making (types)classes, erstellt von Diego Alvarez am 14/04/2018.
- Erstellt von
- Diego Alvarez · Apr 2018
- Aktualisiert
- 14 Apr 2018
- Aufrufe
- 2
- Bewertung