1Foreign Function Interface
2==========================
7The ``foreign import`` keywords declare a value which is defined in Javascript, and its type::
9 foreign import pow :: Number -> Number -> Number
14A 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::
19 return Math.pow(n, p);
21 }""" :: Number -> Number -> Number
26To declare a new type with no constructors, use ``foreign import data`` and provide the kind::
28 foreign import data DOM :: *
30 foreign import document :: {
31 createElement :: String -> DOM
34Importing Type Class Instances
35------------------------------
37Type class instances can be imported with ``foreign import instance``::
39 foreign import instance showString :: Prelude.Show String
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list