FFI Functions
We have also provided some nice functions allowing you to “directly” use an Erlang library:
--if we want to use sin function from math module in Erlang
sin :: Float -> Float
sin = ffi1 :math :sin
-- 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.
当前内容版权归 hamler-lang 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 hamler-lang .