summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_compile
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-09-30 23:13:43 +0100
committerIan Lynagh <igloo@earth.li>2011-09-30 23:52:56 +0100
commitc9a0347796780be9dae33826bd94dad278bb489f (patch)
tree94816bc333dc513edcee3f61c74b8be1eec28ac4 /testsuite/tests/ffi/should_compile
parentf1b395c221a37861ee417d9239e711aa5e11c870 (diff)
downloadhaskell-c9a0347796780be9dae33826bd94dad278bb489f.tar.gz
More cc015 cases
Diffstat (limited to 'testsuite/tests/ffi/should_compile')
-rw-r--r--testsuite/tests/ffi/should_compile/cc015.hs31
1 files changed, 20 insertions, 11 deletions
diff --git a/testsuite/tests/ffi/should_compile/cc015.hs b/testsuite/tests/ffi/should_compile/cc015.hs
index f6aad23636..a21fd3c437 100644
--- a/testsuite/tests/ffi/should_compile/cc015.hs
+++ b/testsuite/tests/ffi/should_compile/cc015.hs
@@ -3,14 +3,17 @@
module Cc015 where
-import Foreign.C
+import Foreign
+import Foreign.C.Types
type S a = a
type IOS a = IO a
+type SFunPtr a = FunPtr a
type family F a
type instance F Int = Int
type instance F Bool = G2
+type instance F Char = FunPtr (Int -> IO Int)
newtype G1 = G1 Int
newtype G1F = G1F (F (S Int))
@@ -20,18 +23,24 @@ newtype G4 = G4 G3
newtype NIO a = NIO (IO a)
-- Type synonyms should be transparent to the typechecker
-foreign import ccall f1 :: S Int -> IOS Int
-foreign export ccall "g1" f1 :: S Int -> IOS Int
+foreign import ccall f1 :: S Int -> IOS Int
+foreign export ccall "g1" f1 :: S Int -> IOS Int
+foreign import ccall "&h1" h1 :: SFunPtr (S Int -> IOS Int)
-- As should type functions
-foreign import ccall f2 :: F Int -> IO (F Int)
-foreign export ccall "g2" f2 :: F Int -> IO (F Int)
+foreign import ccall f2 :: F Int -> IO (F Int)
+foreign export ccall "g2" f2 :: F Int -> IO (F Int)
+foreign import ccall "&h2" h2 :: F Char
+foreign import ccall "&h2b" h2b :: FunPtr (F Int -> IO (F Int))
-- And newtype
-foreign import ccall f3 :: G1 -> G2 -> G4
-foreign export ccall "g3" f3 :: G1 -> G2 -> G4
+foreign import ccall f3 :: G1 -> G2 -> G4
+foreign export ccall "g3" f3 :: G1 -> G2 -> G4
+foreign import ccall "&h3" h3 :: FunPtr (G1 -> G2 -> G4)
-- And a combination
-foreign import ccall f4 :: G1F -> F Bool -> S G4
-foreign export ccall "g4" f4 :: G1F -> F Bool -> S G4
+foreign import ccall f4 :: G1F -> F Bool -> S G4
+foreign export ccall "g4" f4 :: G1F -> F Bool -> S G4
+foreign import ccall "&h4" h4 :: FunPtr (G1F -> F Bool -> S G4)
-- And a newtyped IO
-foreign import ccall f5 :: NIO Int
-foreign export ccall "g5" f5 :: NIO Int
+foreign import ccall f5 :: NIO Int
+foreign export ccall "g5" f5 :: NIO Int
+foreign import ccall "&h5" h5 :: FunPtr (NIO Int)