[project @ 1999-01-23 18:10:00 by sof]
[ghc-hetmet.git] / ghc / tests / codeGen / should_run / cg040.hs
1 module Main(main) where
2
3 data Burble a = B1 { op1 :: a -> Int, op2 :: Int -> a, op3 :: Int}
4               | B2 { op2 :: Int -> a, op4 :: Int -> Int } 
5
6
7 f1 :: Int -> Burble Int
8 f1 n = B1 { op1 = \x->x+n, op2 = \x -> x, op3 = n }
9
10 f2 :: Burble a -> Int -> Int
11 f2 r@(B1 {op1 = op1 , op2 = op2 }) n = op1 (op2 n) + op3 r
12
13 f3 :: Burble a -> Burble a
14 f3 x@(B1 {op3=op3}) = x {op3 = op3+1}
15
16 main = print (f2 (f3 (f1 3)) 4)