rare shit
[fp1415.git] / fp2 / week2 / mart / oldold / old / Map.icl
1 implementation module Map
2
3 //import BinTree
4 import StdMaybe
5 import StdList
6
7 class Map c :: (a -> b) (c a) -> c b
8
9 instance Map [] where
10 Map f [] = []
11 Map f [x:xs] = [f x: Map f xs]
12
13 instance Map Maybe where
14 Map f Nothing = Nothing
15 Map f (Just x) = Just (f x)
16
17 //instance Map Tree where
18 // Map f Leaf = Leaf
19 // Map f (Node x l r) = Node (f x) (mapTree f l) (mapTree f r)