Create ffi.rst
commit970504cc3d24dab9767cddc9a85048f0768df51f
authorPhil Freeman <paf31@cantab.net>
dateWed 22 Jan 2014, 22:21 (13 years ago)
parentbdf466a
docs/source/ffi.rstnew file+17
@@ -0,0 +1,17 @@
1+## Foreign Function Interface
2+
3+The `foreign import` keyword declares a value which is defined in Javascript, and its type:
4+
5+```haskell
6+foreign import pow :: (Number, Number) -> Number
7+```
8+
9+To declare a new type with no constructors, use `foreign import data` and provide the kind:
10+
11+```haskell
12+foreign import data IO :: * -> *
13+
14+foreign import console :: {
15+ log :: String -> IO {}
16+}
17+```