equal
deleted
inserted
replaced
1 {-# OPTIONS_GHC -fglasgow-exts #-} |
1 {-# OPTIONS_GHC -fglasgow-exts #-} |
2 |
2 |
3 module Example where { |
3 module Example where { |
4 |
|
5 foldla :: forall a b. (a -> b -> a) -> a -> [b] -> a; |
|
6 foldla f a [] = a; |
|
7 foldla f a (x : xs) = foldla f (f a x) xs; |
|
8 |
|
9 rev :: forall a. [a] -> [a]; |
|
10 rev xs = foldla (\ xsa x -> x : xsa) [] xs; |
|
11 |
4 |
12 list_case :: forall a b. a -> (b -> [b] -> a) -> [b] -> a; |
5 list_case :: forall a b. a -> (b -> [b] -> a) -> [b] -> a; |
13 list_case f1 f2 (a : list) = f2 a list; |
6 list_case f1 f2 (a : list) = f2 a list; |
14 list_case f1 f2 [] = f1; |
7 list_case f1 f2 [] = f1; |
15 |
8 |