www.idziorek.net | blog | contact
March 2019

# Haskell - Foreign Function Interface

Haskell’s FFI allows easily to cooperate with other languages. Foreign functions can call Haskell code and vice versa. Simple examples can be found in my git repository [1]. For now, the provided Makefile exposes two interesting targets:

• c_from_hask - simple program with a C function called from Haskell.
• hask_from_c - simple programm with a Haskell function called from C.

The next step is to pass more complicated structures via ForeignPtr’s.

## Notes

• since version 8.4 GHC guarantees that garbage collection will never occur during an unsafe call.