aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/hs/Safe.hs
blob: 8994e9eec4180d16f8197c09f04c28d7aed17682 (plain) (blame)
1
2
3
4
5
6
7
8
9
{-#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