1 import "JavaBuiltin" as Java
5 data Thunk a = /* forall s. */ Thunk s (s -> a)
10 runThunk :: Thunk a -> a
11 runThunk (Thunk s f) = f s
13 makeThunk :: a -> Thunk a
14 makeThunk x = Thunk x id
16 mapThunk :: (a -> b) -> Thunk a -> Thunk b
17 mapThunk f (Thunk s g) = Thunk s (\x -> f (g x))
19 a = makeThunk (13 :: Integer)
20 b = mapThunk (\x -> x+1) a