Safe Haskell | None |
---|
These classes are used to make various JavaScriptCore types out of whatever we have. Functions in jsc take these as inputs. This alows implicit casting and eager evaluation.
- class MakeValueRef a where
- makeValueRef :: a -> JSC JSValueRef
- class MakeStringRef a where
- makeStringRef :: a -> JSStringRef
- class MakeArgRefs this where
- makeArgRefs :: this -> JSC [JSValueRef]
- class MakeObjectRef this where
- makeObjectRef :: this -> JSC JSObjectRef
- class MakePropRef this where
- makePropRef :: this -> JSC JSPropRef
Type classes to convert Haskell data to JavaScript
class MakeValueRef a where
Anything that can be used to make a JavaScript value reference
makeValueRef :: a -> JSC JSValueRef
MakeValueRef Bool | Make a JavaScript boolean value |
MakeValueRef Double | Makes a JavaScript number |
MakeValueRef String | Makes a JavaScript string |
MakeValueRef Text | Makes a JavaScript string |
MakeValueRef JSValueRef | If we already have a JSValueRef we are fine |
MakeValueRef JSPropRef | We can use a property as a value. |
MakeValueRef JSValue | Makes a JavaScript value from a |
MakeValueRef JSUndefined | Makes an |
MakeValueRef JSNull | Makes a |
MakeValueRef JSCallAsFunction | A callback to Haskell can be used as a JavaScript value. This will create
an anonymous JavaScript function object. Use |
MakeValueRef v => MakeValueRef (JSC v) | JSValueRef can be made by evaluating a function in |
class MakeStringRef a where
Anything that can be used to make a JavaScript string reference
makeStringRef :: a -> JSStringRef
MakeStringRef String | |
MakeStringRef Text | |
MakeStringRef JSStringRef | If we already have a JSStringRef we are fine |
class MakeArgRefs this where
Anything that can be used to make a list of JavaScript value references for use as function arguments
makeArgRefs :: this -> JSC [JSValueRef]
MakeArgRefs Bool | Makes an argument list with just a single JavaScript boolean value |
MakeArgRefs Double | Makes an argument list with just a single JavaScript number |
MakeArgRefs () | This allows us to pass no arguments easily (altenative would be to use |
MakeArgRefs Text | Makes an argument list with just a single JavaScript string |
MakeArgRefs JSValueRef | A single JSValueRef can be used as the argument list |
MakeArgRefs JSPropRef | We can pass a property as the only paramter to a function. |
MakeArgRefs JSValue | Makes an argument list with just a single JavaScript value from a |
MakeArgRefs JSNull | Makes an argument list with just a single |
MakeArgRefs JSCallAsFunction | |
MakeValueRef arg => MakeArgRefs [arg] | |
MakeArgRefs arg => MakeArgRefs (JSC arg) | |
(MakeValueRef arg1, MakeValueRef arg2) => MakeArgRefs (arg1, arg2) | |
(MakeValueRef arg1, MakeValueRef arg2, MakeValueRef arg3) => MakeArgRefs (arg1, arg2, arg3) | |
(MakeValueRef arg1, MakeValueRef arg2, MakeValueRef arg3, MakeValueRef arg4) => MakeArgRefs (arg1, arg2, arg3, arg4) | |
(MakeValueRef arg1, MakeValueRef arg2, MakeValueRef arg3, MakeValueRef arg4, MakeValueRef arg5) => MakeArgRefs (arg1, arg2, arg3, arg4, arg5) |
class MakeObjectRef this where
Anything that can be used to make a JavaScript object reference
makeObjectRef :: this -> JSC JSObjectRef
MakeObjectRef JSObjectRef | If we already have a JSObjectRef we are fine |
MakeObjectRef JSPropRef | We can use a property as an object. |
MakeObjectRef JSNull | |
MakeObjectRef v => MakeObjectRef (JSC v) | JSObjectRef can be made by evaluating a function in |
class MakePropRef this where
Anything that can be used to make a JavaScript property reference
makePropRef :: this -> JSC JSPropRef
MakePropRef JSPropRef | If we already have a JSPropRef we are fine |
MakePropRef prop => MakePropRef (JSC prop) | JSPropRef can be made by evaluating a function in |