summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/cgrun035.hs
blob: dfd73cb40a68b71df2cf935a154d6d71746c82eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Main (main) where

import Foreign.C
import System.IO.Unsafe ( unsafePerformIO )

c :: Double -> Double
c x = cos x
  where
    cos :: Double -> Double
    cos x = realToFrac (unsafePerformIO (c_cos (realToFrac x)))

foreign import ccall unsafe "cos"
  c_cos :: CDouble -> IO CDouble

main = putStr (shows (c 0.0) "\n")