Foreign Function Interface
A foreign function interface (FFI) is provided to allow husk to call into arbitrary Haskell code. The interface is available via the
(load-ffi "Language.Scheme.Plugins.CPUTime" "precision" "cpu-time:precision")
cpu-time:precision is loaded, it may be called directly from husk just like a regular Scheme function:
(cpu-time:precision)
Any Haskell function loaded via the FFI must be of the following type:
[LispVal] -> IOThrowsError LispVal
See the Language.Scheme.Plugins.CPUTime module for an example of how to use the FFI.
Note by default the FFI is disabled, which allows husk to avoid unnecessarily linking to the GHC API. This significantly reduces its compiled size out-of-the-box. To enable the FFI just pass the option |