Commit 9d111543 authored by Ian Lynagh's avatar Ian Lynagh

Add some tests for handling of FFI types

parent e54ec3bc
...@@ -36,3 +36,4 @@ test('ffi-deriv1', normal, compile, ['']) ...@@ -36,3 +36,4 @@ test('ffi-deriv1', normal, compile, [''])
test('1357', normal, compile, ['']) test('1357', normal, compile, [''])
test('3624', normal, compile, ['']) test('3624', normal, compile, [''])
test('3742', normal, compile, ['']) test('3742', normal, compile, [''])
test('cc015', normal, compile, [''])
{-# LANGUAGE TypeFamilies #-}
module Cc015 where
type S a = a
type IOS a = IO a
type family F a
type instance F Int = Int
type instance F Bool = G2
newtype G1 = G1 Int
newtype G1F = G1F (F (S Int))
newtype G2 = G2 Char
newtype G3 = G3 (IO Int)
newtype G4 = G4 G3
-- 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
-- As should type functions
foreign import ccall f2 :: F Int -> IO (F Int)
foreign export ccall "g2" f2 :: F Int -> IO (F Int)
-- And newtype
foreign import ccall f3 :: G1 -> G2 -> G4
foreign export ccall "g3" f3 :: 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment