GoConqr has a new look! Let us know what you think.

Mind map

Making Our Own Types and Typeclasses

Nicolas Medina English

Making Our Own Types and Typeclasses

Map content

Making Our Own Types and Typeclasses

  1. To define a new data type we use the word data

    • The part before the = is the Type and after the = are the value constructors: specify the values that the type can have
      • we can optionally add some types after it and those types define the values it will contain.
        • if there's only one value constructor, we can use the same name for the data type and the value constructor
          • We can export our data types. we just have to write it in the module declaration.
            • In parentheses, we specify the value constructor.
              • To add everything just put ( .. ) inside the parentheses.
  2. RECORD SYNTAX

    • It’s an alternative to write data types.
      • We write the field types, and then write double colon :: to specify the type
  3. Derived instances

    • Haskell can derive the behavior of these types to our data types.
  4. Type synonyms

    • Give different names to the type data so that they make more sense to someone reading our code and documentation.
  5. Recursive data structures

    • where one value of some type contains values of that type, which in turn contain more values of the same type and so on.
  6. Binary search tree

    • An element points to two elements, one on its left and one on its right. The element to the left is smaller, the element to the right is bigger.

Images and files in the map

  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses
  • Making Our Own Types and Typeclasses

Information

Description
Mind Map on Making Our Own Types and Typeclasses, created by Nicolas Medina on 19/09/2018.
Created by
Nicolas Medina
Views
0
Rating

More on Data Types and Typeclasses

Feedback

What is it about?

What do you think of the new look?

How do you like it?