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

Mindmap

Making Our Own Types and Typeclasses

HERRERA BOHORQUEZ JAVIER FELIPE Spanisch

Inhalt der Mindmap

Making Our Own Types and Typeclasses

  1. Algebraic data types

    • use the data keyword to define a type
      • means that we're defining a new data type.
      • has to have constructor attributes
      • some data types Bool, Int, Char, Maybe
    • Representation of a shape in haskell
      • tuples
      • could also represent a 3D vector or anything else
      • make our own type to represent a shape
        • can optionally add some types after it and those types define the values it will contain
        • can also export data types in diferent modules
  2. Record syntax

    • define what information wan to record
      • set the data type
      • use curly brackets
        • write a double colon
          • specify the type
            • creates functions that lookup fields in the data type
  3. Type parameters

    • can take some values parameters and then produce a new value
    • can take types as parameters to produce new types
    • can make different types with them depending on what kind of types we want contained in our data type
  4. Derived instances

    • Haskell can automatically make our type an instance of any of the following typeclasses
    • Haskell can derive the behavior of the types
  5. Type synonyms

    • they do nothing by itself
    • gave some types different names so that they make more sense to someone reading our code and documentation

Informationen

Beschreibung
Mindmap am Making Our Own Types and Typeclasses, erstellt von HERRERA BOHORQUEZ JAVIER FELIPE am 09/10/2020.
Aufrufe
0
Bewertung

Mehr zu Data Types and Typeclasses

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck