summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/cgrun040.hs
blob: d747d4ab8bc1e0e03f61ea5551388d3f9a3f21b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Main(main) where

data Burble a = B1 { op1 :: a -> Int, op2 :: Int -> a, op3 :: Int}
	      | B2 { op2 :: Int -> a, op4 :: Int -> Int } 


f1 :: Int -> Burble Int
f1 n = B1 { op1 = \x->x+n, op2 = \x -> x, op3 = n }

f2 :: Burble a -> Int -> Int
f2 r@(B1 {op1 = op1 , op2 = op2 }) n = op1 (op2 n) + op3 r

f3 :: Burble a -> Burble a
f3 x@(B1 {op3=op3}) = x {op3 = op3+1}

main = print (f2 (f3 (f1 3)) 4)