GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Types and Typeclasses

SUAREZ HERNANDEZ SANTIAGO Spanisch

Inhalt der Mindmap

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...

Informationen

Beschreibung
Mindmap am Types and Typeclasses, erstellt von SUAREZ HERNANDEZ SANTIAGO am 20/03/2019.
Aufrufe
0
Bewertung

Mehr zu Data Types and Typeclasses

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck