Gestalte GoConqr mit. Was sollen wir als Nächstes hinzufügen?

Mindmap

Custom Types and Typeclasses

ALVARO ANTONIO STAGG RAMIREZ Englisch

Inhalt der Mindmap

Custom Types and Typeclasses

  1. Can be defined with the "data" keyword

  2. Can implement other typeclasses traits

    • Use de "deriving" keyword
  3. Can be exported

    • Add "(..)" if wanna export all value constructors
  4. Named data attributes

    • "Record Syntax"
  5. Type parameters

    • "data MyType p = ..."
  6. Derived Instances

    • Can create Enums
    • Kinda "extends"
  7. Type Synonyms

    • String = [Char]
    • "type String = [Char]"
  8. Can be recusirve

    • "data MyType a = Empty | Cons (MyType a)"
  9. Fixity declarations

    • Make functions infix by default
      • "infix <fixity> <FuncName>"
  10. 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
  11. Functor Typeclass

    • Generic interface for applying functions to values in a container or context.

Informationen

Beschreibung
Mindmap am Custom Types and Typeclasses, erstellt von ALVARO ANTONIO STAGG RAMIREZ am 06/10/2021.
Aufrufe
1
Bewertung

Mehr zu Data Types and Typeclasses

Feedback

Worum geht es?

Was sollen wir als Nächstes hinzufügen?