1 {-# LANGUAGE ForeignFunctionInterface #-}
5 import Foreign
.C
(CInt
(..))
7 foreign import ccall
"meaning_of_life_c"
8 meaning_of_life_c
:: IO CInt
12 secret
<- meaning_of_life_c
13 -- The value 11 comes from the exported Lib.hello
15 then putStrLn ("The secret is " ++ show secret
)
16 else error ("Expected value 11, got " ++ show secret
)