@@ -1,17 +1,31 @@
1−## Foreign Function Interface
1+Foreign Function Interface
2+==========================
3−The `foreign import` keyword declares a value which is defined in Javascript, and its type:
4+Importing Values
5−```haskell
7+The `foreign import` keyword declares a value which is defined in Javascript, and its type::
6−foreign import pow :: (Number, Number) -> Number
9−To declare a new type with no constructors, use `foreign import data` and provide the kind:
9+ foreign import pow :: Number -> Number -> Number
11−```haskell
11+Inline Javascript
12−foreign import data IO :: * -> *
12+-----------------
14+A foreign import declaration may optionally contain its definition in Javascript as a string literal. If this is provided, the string will be inserted directly into the generated Javascript before the current module definition::
16+ foreign import pow "function pow(n) {\
17+ \ return function(p) {\
18+ \ return Math.pow(n, p);\
20+ \}" :: Number -> Number -> Number
25+To declare a new type with no constructors, use `foreign import data` and provide the kind::
27+ foreign import data DOM :: *
14−foreign import console :: {
29+ foreign import document :: {
15− log :: String -> IO {}
30+ createElement :: String -> DOM