¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Types and Typeclasses

SUAREZ HERNANDEZ SANTIAGO Español

Contenido del mapa

Types and Typeclasses

  1. Use the data keyword to define a type

  2. Value constructors are actually functions that return a value of a data type

  3. You can export your data types in your modules: Shape(..)

  4. Record syntax

    • data Person = Person { firstName :: String , ...
  5. Type parameters

    • We use them when our data type would work regardless of the type of the value it then holds inside it
  6. Typeclass is a sort of an interface that defines some behavior

  7. Derived instances

    • A type is an instance of a typeclass if the type has the behavior of the typeclass
  8. Type synonyms

    • They're just about giving some types different names
    • Just like we call a function with too few parameters to get back a new function, we can specify a type constructor with too few type parameters and get back a partially applied type constructor.
  9. A typeclass is a sort of an interface that defines some behavior

  10. Recursive data structures

    • We can make types whose constructors have fields that are of the same type
  11. Types

    • data Bool = False | True
      • type = The different values that this type can have
    • if we add deriving (Show) at the end of a data declaration, that type become part of the Show typeclass
      • data Shape ...|... deriving (Show)
    • Intermediate data type
      • data Point = Point Float Float data Shape = Circle Point Float
  12. Typeclass

    • A typeclass defines some behavior like comparing for equality and then types that can behave in that way are made instances of that typeclass
    • class Eq a where...

Información

Descripción
Mapa Mental sobre Types and Typeclasses, creado por SUAREZ HERNANDEZ SANTIAGO el 20/03/2019.
Visitas
0
Valoración

Más sobre Data Types and Typeclasses

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?