[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / tests / ccall / cc004.hs
1 --!!! cc004 -- ccall with synonyms, polymorphic type variables and user type variables.
2 module Test where
3
4 import PreludeGlaIO
5
6 -- Since I messed up the handling of polymorphism originally, I'll
7 -- explicitly test code with UserSysTyVar (ie an explicit polymorphic
8 -- signature)
9
10 foo = _ccall_ f `thenADR` \ a -> returnPrimIO (a + 1)
11  where 
12    thenADR :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
13    m `thenADR` k  = \ s -> case m s of
14                          (a,t) -> k a t
15
16 -- and with a PolySysTyVar (ie no explicit signature)
17
18 bar = _ccall_ f `thenADR` \ a -> returnPrimIO (a + 1)
19  where 
20    -- thenADR :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
21    m `thenADR` k  = \ s -> case m s of
22                          (a,t) -> k a t
23
24 -- and with a type synonym
25
26 type INT = Int
27 barfu :: PrimIO INT
28 barfu = _ccall_ b
29