diff options
Diffstat (limited to 'testsuite/tests/safeHaskell/safeLanguage/SafeLang08.hs')
-rw-r--r-- | testsuite/tests/safeHaskell/safeLanguage/SafeLang08.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang08.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang08.hs new file mode 100644 index 0000000000..7249c8d0ec --- /dev/null +++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang08.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE Safe #-} +{-# LANGUAGE ForeignFunctionInterface #-} + +-- | Make sure FFI must be IO type +module Main where + +import Foreign.C + +foreign import ccall "SafeLang08_A" c_sin :: CDouble -> CDouble + +sinx :: Double -> Double +sinx d = realToFrac $ c_sin $ realToFrac d + +x :: Double +x = 0.8932 + +main :: IO () +main = do + putStrLn "Hello World" + putStrLn $ "Sin of " ++ (show x) ++ " is " ++ (show $ sinx x) + |