Mapa mental
Custom Types and Typeclasses
Contenido del mapa
Custom Types and Typeclasses
Can be defined with the "data" keyword
Can implement other typeclasses traits
- Use de "deriving" keyword
Can be exported
- Add "(..)" if wanna export all value constructors
Named data attributes
- "Record Syntax"
Type parameters
- "data MyType p = ..."
Derived Instances
- Can create Enums
- Kinda "extends"
Type Synonyms
- String = [Char]
- "type String = [Char]"
Can be recusirve
- "data MyType a = Empty | Cons (MyType a)"
Fixity declarations
- Make functions infix by default
- "infix <fixity> <FuncName>"
- Make functions infix by default
Typeclass behaviour
- defining functions without implementation
- Define a new Typeclass
- "class <Name> <Generic> where"
- Create implementation for data using "instance"
- "instance <Typeclass> <OurType> where"
- Can be subclasses
Functor Typeclass
- Generic interface for applying functions to values in a container or context.
Información
- Descripción
- Mapa Mental sobre Custom Types and Typeclasses, creado por ALVARO ANTONIO STAGG RAMIREZ el 06/10/2021.
- Creado por
- ALVARO ANTONIO STAGG RAMIREZ
- Visitas
- 1
- Valoración
Más sobre Data Types and Typeclasses