4 Course I00032 Advanced Programming 2014
5 Skeleton for assignment 1
11 /**************** Prelude: *******************************/
13 :: Color = Red | Yellow | Blue
14 :: Tree a = Tip | Bin a (Tree a) (Tree a)
15 :: Rose a = Rose a [Rose a]
17 // Binary sums and products (in generic prelude)
19 :: PAIR a b = PAIR a b
20 :: EITHER a b = LEFT a | RIGHT b
22 // Generic type representations
23 :: RoseG a :== PAIR a [Rose a]
26 fromRose :: (Rose a) -> RoseG a
27 fromRose (Rose a l) = PAIR a l
31 :: Ordering = Smaller | Equal | Bigger
33 class (><) infix 4 a :: !a !a -> Ordering
35 instance >< Int where // Standard ordering for Int
41 instance >< Char where // Standard ordering for Char
47 instance >< String where // Standard lexicographical ordering
53 instance >< Bool where // False is smaller than True
54 (><) False True = Smaller
55 (><) True False = Bigger
58 /**************** End Prelude *************************/