Help shape GoConqr. What should we add next?

Mind map

Custom Types and Typeclasses

ALVARO ANTONIO STAGG RAMIREZ English

Map content

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.

Information

Description
Mind Map on Custom Types and Typeclasses, created by ALVARO ANTONIO STAGG RAMIREZ on 06/10/2021.
Views
1
Rating

More on Data Types and Typeclasses

Feedback

What is it about?

What should we add next?