[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / tests / ccall / cc004.hs
diff --git a/ghc/compiler/tests/ccall/cc004.hs b/ghc/compiler/tests/ccall/cc004.hs
new file mode 100644 (file)
index 0000000..7ad0ced
--- /dev/null
@@ -0,0 +1,29 @@
+--!!! cc004 -- ccall with synonyms, polymorphic type variables and user type variables.
+module Test where
+
+import PreludeGlaIO
+
+-- Since I messed up the handling of polymorphism originally, I'll
+-- explicitly test code with UserSysTyVar (ie an explicit polymorphic
+-- signature)
+
+foo = _ccall_ f        `thenADR` \ a -> returnPrimIO (a + 1)
+ where 
+   thenADR :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
+   m `thenADR` k  = \ s -> case m s of
+                         (a,t) -> k a t
+
+-- and with a PolySysTyVar (ie no explicit signature)
+
+bar = _ccall_ f        `thenADR` \ a -> returnPrimIO (a + 1)
+ where 
+   -- thenADR :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
+   m `thenADR` k  = \ s -> case m s of
+                         (a,t) -> k a t
+
+-- and with a type synonym
+
+type INT = Int
+barfu :: PrimIO INT
+barfu = _ccall_ b
+