blob: 8994e9eec4180d16f8197c09f04c28d7aed17682 (
plain) (
tree)
|
|
{-#Language ForeignFunctionInterface#-}
module Safe where
import Foreign.C.Types
fibonacci :: Int -> Int
fibonacci n = fibs !! n
where fibs = 0 : 1: zipWith (+) fibs (tail fibs)
fibonacci_hs ::CInt -> CInt
fibonacci_hs = fromIntegral.fibonacci.fromIntegral
foreign export ccall fibonacci_hs::CInt->CInt
|