add Haskell to Rust example

This commit is contained in:
Bill Murphy
2015-10-13 21:23:49 -04:00
parent 9b6be2f3fa
commit e8d35d56d7
5 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign.C
foreign import ccall "double_input" doubleInput :: CInt -> CInt
main = do
let input = 4
let output = doubleInput input
putStrLn $ show input ++ " * 2 = " ++ show output

View File

@@ -0,0 +1,4 @@
#[no_mangle]
pub extern fn double_input(input: i32) -> i32 {
input * 2
}