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

Mindmap

Chapter 8

NICOLÁS ALBORNOZ TIBASOZA Spanisch

Inhalt der Mindmap

Chapter 8

  1. Algebraic data types

    • Define our own data types
    • using the word "data"
      • means that a new data type is being defined
    • It is necessary to write the data type name
    • Value constructors
      • Defines the values that can take the data type that is going to be defined
    • Example
      • data Bool = True | False
  2. Record syntax

    • Modules can define data types aswell
      • To be more simple to understand and read it is used record syntax
        • Works the same way as the algebraic data types, the only difference is that it's more readable
        • Record syntax works like object oriented prgramming
          • We define the attributes and their data types
  3. Type parameters

    • Instead of having values as parameters we have data types as parameters
    • For example
      • data Maybe a = Nothing | Just a
        • "a" is a type parameter
          • the result could be Just Int or Just Char
  4. Derived instances

    • It is used to implement a behaviour in a new data type
      • To do so it is necessary to use the word "Deriving"
        • And then write the typeclass we want to implement
        • For example: deriving (Eq, Show, Read)
  5. Type synonims

    • Give types a different name
      • For example [Char], its type synomim would be String
  6. Typeclasses 102

    • As we can define modules, we can also define our own typeclasses
      • To define a new typeclass we use the word "class" followed by the name and then "where"
        • class Eq a where

Informationen

Beschreibung
Mindmap am Chapter 8, erstellt von NICOLÁS ALBORNOZ TIBASOZA am 26/03/2019.
Aufrufe
2
Bewertung

Mehr zu Data Types and Typeclasses

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck