Mind map
Making Our Own Types and Typeclasses
Map content
Making Our Own Types and Typeclasses
To define a new data type we use the word data
- The part before the = is the Type and after the = are the value constructors: specify the values that the type can have
- we can optionally add some types after it and those types define the values it will contain.
- if there's only one value constructor, we can use the same name for the data type and the value constructor
- We can export our data types. we just have to write it in the module declaration.
- In parentheses, we specify the value constructor.
- To add everything just put ( .. ) inside the parentheses.
- In parentheses, we specify the value constructor.
- We can export our data types. we just have to write it in the module declaration.
- if there's only one value constructor, we can use the same name for the data type and the value constructor
- we can optionally add some types after it and those types define the values it will contain.
- The part before the = is the Type and after the = are the value constructors: specify the values that the type can have
RECORD SYNTAX
- It’s an alternative to write data types.
- We write the field types, and then write double colon :: to specify the type
- It’s an alternative to write data types.
Derived instances
- Haskell can derive the behavior of these types to our data types.
Type synonyms
- Give different names to the type data so that they make more sense to someone reading our code and documentation.
Recursive data structures
- where one value of some type contains values of that type, which in turn contain more values of the same type and so on.
Binary search tree
- An element points to two elements, one on its left and one on its right. The element to the left is smaller, the element to the right is bigger.
Images and files in the map
Information
- Description
- Mind Map on Making Our Own Types and Typeclasses, created by Nicolas Medina on 19/09/2018.
- Created by
- Nicolas Medina
- Views
- 0
- Rating
More on Data Types and Typeclasses