summaryrefslogtreecommitdiff
path: root/ghc/compiler/tests/ccall/cc004.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/compiler/tests/ccall/cc004.hs')
-rw-r--r--ghc/compiler/tests/ccall/cc004.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/ghc/compiler/tests/ccall/cc004.hs b/ghc/compiler/tests/ccall/cc004.hs
new file mode 100644
index 0000000000..7ad0ceda16
--- /dev/null
+++ b/ghc/compiler/tests/ccall/cc004.hs
@@ -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
+