fay-0.11.0.0: A compiler for Fay, a Haskell subset that compiles to JavaScript.

Safe HaskellNone

Language.Fay.FFI

Synopsis

Documentation

data Fay a Source

The JavaScript FFI interfacing monad.

Instances

Monad Fay 
Foreign a => Foreign (Fay a)

JS values are foreignable.

class Foreign a Source

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) 

data Nullable a Source

Values that may be null Nullable x decodes to x, Null decodes to null.

Constructors

Nullable a 
Null 

Instances

data Defined a Source

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.

Constructors

Defined a 
Undefined 

Instances

ffiSource

Arguments

:: Foreign a 
=> String

The foreign value.

-> a

Bottom.

Declare a foreign action.