Haskell から C 言語で書いた関数を呼ぶには。http://haskell.g.hatena.ne.jp/jmk/20060622/1150947486を見れば完璧だが、とりあえずこれだけでいいよ、という最小サンプル的な意味でメモ。 factorial.hs {-# LANGUAGE ForeignFunctionInterface #-} import Foreign.C.Types foreign import ccall "fact.h fact" c_fact :: CInt -> IO Int main = c_fact 10 >>= print fact.h #ifndef __FACT_H__ #define __FACT_H__ int fact(int n); #endif fact.c #include "fact.h" int fact(int n) { if