FFI Functions

We have also provided some nice functions allowing you to “directly” use an Erlang library:

  1. --if we want to use sin function from math module in Erlang
  2. sin :: Float -> Float
  3. sin = ffi1 :math :sin
  4. -- foreign import ffi1 :: forall a b. Atom -> Atom -> a -> b

Where ffi1 is a function takes in two atoms to locate the function in the Erlang library, and the number 1 means this function needs argument. There are more in the lib.