Mindmap
Chapter 8: Making Our Own Types and Typeclasses

Inhalt der Mindmap
Chapter 8: Making Our Own Types and Typeclasses
Algebraic data types
- Define new data types
- structure
- structure
- Define new data types
Record syntax
- Record info of a type data with custom fields
- 1. Write the name of the field
- 2. "::"
- 3. Specify the type
- 2. "::"
- 1. Write the name of the field
- Creates functions that lookup fields in the data type
- Record info of a type data with custom fields
Derived instances
- Typeclass is a sort of an interface that defines some behavior.
- Haskell can make a type an instance of:
- Eq
- Ord
- Enum
- Bounded
- Show
- Read
- Keyword: Deriving
- Haskell can make a type an instance of:
- Typeclass is a sort of an interface that defines some behavior.
Type synonyms
- Gives some types different names to make more sense reading our code and documentation.
- Keyword: Type
- Gives some types different names to make more sense reading our code and documentation.
Recursive data structures
- One value of some type contains values of that type
- One value of some type contains values of that type
Typeclasses 102
- Typeclasses are like interfaces
- defines some behavior
- Structure
- 1. Define typeclass
- Ex: Class Eq a where
- 2. Define functions
- 1. Define typeclass
- Typeclasses are like interfaces
Bilder und Dateien der Mindmap
Informationen
- Beschreibung
- Mindmap am Chapter 8: Making Our Own Types and Typeclasses, erstellt von MARIA GABRIELA MEJIA TRUJILLO am 07/10/2021.
- Erstellt von
- MARIA GABRIELA MEJIA TRUJILLO
- Aufrufe
- 0
- Bewertung
Mehr zu Data Types and Typeclasses