summaryrefslogtreecommitdiff
path: root/ghc/compiler/tests/stranal/map.lhs
blob: d79ec03c1bac6c5b49167071346933bc2fda00f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
> data Boolean = FF | TT
> data Pair a b = MkPair a b
> data LList alpha = Nill | Conss alpha (LList alpha) 
> data Nat = Zero | Succ Nat
> data Tree x = Leaf x | Node (Tree x) (Tree x) 
> data A a = MkA a (A a) 

> {-
> map :: (a -> b) -> [a] -> [b]
> map f xs = case xs of
>              []     -> []
>              (y:ys) -> (f y):(map f ys)

> map_ide :: [[a]] -> [[a]]
> map_ide = map (\x->x)
>-}

> id :: a -> a
> id x = x

> idNat :: Nat -> Nat
> idNat x = x

> idBool :: Boolean -> Boolean
> idBool x = x

> fun :: (a->b) -> a -> b
> fun f x = g f
>  where 
>   g f   = f x