Defining Data Types
data Tree a = Node a (Tree a) (Tree a) | Leaf
deriving Show
Type name
Type parameter
Types may take parameters.
Enables us to define polymorphic functions which work on a tree with any type of labels.
Constants start
with upper case,
variables with lower
Föregående bild
Nästa bild
Tillbaka till första bilden
Visa grafisk version