| Safe Haskell | None |
|---|
Language.Fay.FFI
Documentation
The JavaScript FFI interfacing monad.
Contains allowed foreign function types.
Instances
| Foreign Bool | Bools are OK. |
| Foreign Char | Characters are OK. |
| Foreign Double | All numbers in JS are double. |
| Foreign Int | Some numbers in JS are int. |
| Foreign () | Unit is OK. |
| Foreign a => Foreign [a] | Lists → arrays are OK. |
| Foreign a => Foreign (Maybe a) | Maybes are pretty common. |
| Foreign a => Foreign (Fay a) | JS values are foreignable. |
| Foreign a => Foreign (Defined a) | |
| Foreign a => Foreign (Nullable a) | |
| (Foreign a, Foreign b) => Foreign (a -> b) | Functions are foreignable. |
| (Foreign a, Foreign b) => Foreign (a, b) | Tuples → arrays are OK. |
| (Foreign a, Foreign b, Foreign c) => Foreign (a, b, c) | |
| (Foreign a, Foreign b, Foreign c, Foreign d) => Foreign (a, b, c, d) | |
| (Foreign a, Foreign b, Foreign c, Foreign d, Foreign e) => Foreign (a, b, c, d, e) | |
| (Foreign a, Foreign b, Foreign c, Foreign d, Foreign e, Foreign f) => Foreign (a, b, c, d, e, f) | |
| (Foreign a, Foreign b, Foreign c, Foreign d, Foreign e, Foreign f, Foreign g) => Foreign (a, b, c, d, e, f, g) |
Values that may be null Nullable x decodes to x, Null decodes to null.
Values that may be undefined Defined x encodes to x, Undefined decodes to undefined. An undefined property in a record will be removed when encoding.
Do not serialize the specified type. This is useful for, e.g.
foo :: String -> String foo = ffi "%1"
This would normally serialize and unserialize the string, for no reason, in this case. Instead:
foo :: Ptr String -> Ptr String
Will just give an identity function.
The opposite of Ptr. Serialize the specified polymorphic type.
foo :: Automatic a -> String