----------------------------------------- algebraic data types
---------------------------------------------- simple examples

data PrimaryColour = Yellow | Red | Blue   -- enumeration type

data Points = Point Float Float  -- typle type, based on Float

type Name = String
type MatrNr = Int
data StudId = Stud Name MatrNr
                        -- record type, based on type synonyms

data Pairs a = Pair a a
                -- polymorphic type, based on arbitrary type a

data Union a b = Fst a | Snd b
               -- union type, based on arbitrary types a and b

data Tree a = Inner a (Tree a) (Tree a) | Leaf a
                                 -- recursive polymorphic type

{-
Main> :t Stud "Franz Gans" 4711
Stud "Franz Gans" 4711 :: StudId
Main> :t Point 0.0 0.0
Point 0.0 0.0 :: Points
Main> :t Leaf "Franz Ganz"
Leaf "Franz Ganz" :: Tree [Char]
Main> :t Fst 3.14
Fst 3.14 :: Fractional a => Union a b
Main> :t Inner 1 (Inner 2 (Leaf 3) (Leaf 4)) (Leaf 5)
Inner 1 (Inner 2 (Leaf 3) (Leaf 4)) (Leaf 5) :: Num a => Tree a
Main> Inner 1 (Inner 2 (Leaf 3) (Leaf 4)) (Leaf 5)

ERROR: Cannot find "show" function for:
*** expression : Inner 1 (Inner 2 (Leaf 3) (Leaf 4)) (Leaf 5)
*** of type    : Tree Int
-}


