aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/hs/Safe.hs
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-03-19 14:08:48 +0000
committerbloodstalker <thabogre@gmail.com>2018-03-19 14:08:48 +0000
commit256aa3de2212dd77d80f4cf86c64f988b448bbc7 (patch)
tree2237b97f18bb6d5830e69bef7959f5726a6e3a4b /bruiser/hs/Safe.hs
parentadded a lua module for asmrewriter, will soon add docs. you can try the new m... (diff)
downloadmutator-256aa3de2212dd77d80f4cf86c64f988b448bbc7.tar.gz
mutator-256aa3de2212dd77d80f4cf86c64f988b448bbc7.zip
some fixes
Diffstat (limited to '')
-rw-r--r--bruiser/hs/Safe.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/bruiser/hs/Safe.hs b/bruiser/hs/Safe.hs
new file mode 100644
index 0000000..8994e9e
--- /dev/null
+++ b/bruiser/hs/Safe.hs
@@ -0,0 +1,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