jsaddle-0.9.6.0: Interface for JavaScript that works with GHCJS and GHC

Safe HaskellNone
LanguageHaskell2010

Language.Javascript.JSaddle.Classes

Contents

Description

These classes are used to make various JavaScript types out of whatever we have. Functions in jsaddle take these as inputs. This alows implicit casting and eager evaluation.

Synopsis

Type classes to convert Haskell data to JavaScript

class PToJSVal a where Source #

Methods

pToJSVal :: a -> JSVal Source #

Instances
PToJSVal Bool Source # 
Instance details

Defined in GHCJS.Marshal.Pure

Methods

pToJSVal :: Bool -> JSVal Source #

PToJSVal JSVal Source # 
Instance details

Defined in GHCJS.Marshal.Pure

Methods

pToJSVal :: JSVal -> JSVal Source #

PToJSVal MutableArrayBuffer Source # 
Instance details

Defined in JavaScript.TypedArray.ArrayBuffer.Internal

class PFromJSVal a where Source #

Methods

pFromJSVal :: JSVal -> a Source #

Instances
PFromJSVal () Source # 
Instance details

Defined in GHCJS.Marshal.Pure

Methods

pFromJSVal :: JSVal -> () Source #

PFromJSVal JSVal Source # 
Instance details

Defined in GHCJS.Marshal.Pure

PFromJSVal MutableArrayBuffer Source # 
Instance details

Defined in JavaScript.TypedArray.ArrayBuffer.Internal

class ToJSVal a where Source #

Minimal complete definition

Nothing

Methods

toJSVal :: a -> JSM JSVal Source #

toJSValListOf :: [a] -> JSM JSVal Source #

toJSVal :: (Generic a, GToJSVal (Rep a ())) => a -> JSM JSVal Source #

Instances
ToJSVal Bool Source #

Make a JavaScript boolean value

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Char Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Double Source #

Makes a JavaScript number

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Float Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Int Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Int8 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Int16 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Int32 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Word Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Word8 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Word16 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Word32 Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Text Source #

Makes a JavaScript string

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Value Source #

Makes a JSON value

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal JSString Source #

Makes a JavaScript string

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal JSVal Source #

If we already have a JSVal we are fine

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Object Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal JSCallAsFunction Source #

A callback to Haskell can be used as a JavaScript value. This will create an anonymous JavaScript function object. Use function to create one with a name.

Instance details

Defined in Language.Javascript.JSaddle.Object

ToJSVal JSValue Source #

Makes a JavaScript value from a JSValue ADT.

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal JSUndefined Source #

Makes an undefined JavaScript value

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal JSNull Source #

Makes a null JavaScript value

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal Function Source # 
Instance details

Defined in Language.Javascript.JSaddle.Object

ToJSVal a => ToJSVal [a] Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

toJSVal :: [a] -> JSM JSVal Source #

toJSValListOf :: [[a]] -> JSM JSVal Source #

ToJSVal a => ToJSVal (Maybe a) Source #

Makes a JSVal or null JavaScript value

Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSVal v => ToJSVal (JSM v) Source #

JSVal can be made by evaluating a function in JSM as long as it returns something we can make into a JSVal.

Instance details

Defined in Language.Javascript.JSaddle.Value

(ToJSVal a, ToJSVal b) => ToJSVal (a, b) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b) -> JSM JSVal Source #

toJSValListOf :: [(a, b)] -> JSM JSVal Source #

(ToJSVal a, ToJSVal b, ToJSVal c) => ToJSVal (a, b, c) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b, c) -> JSM JSVal Source #

toJSValListOf :: [(a, b, c)] -> JSM JSVal Source #

(ToJSVal a, ToJSVal b, ToJSVal c, ToJSVal d) => ToJSVal (a, b, c, d) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b, c, d) -> JSM JSVal Source #

toJSValListOf :: [(a, b, c, d)] -> JSM JSVal Source #

(ToJSVal a, ToJSVal b, ToJSVal c, ToJSVal d, ToJSVal e) => ToJSVal (a, b, c, d, e) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b, c, d, e) -> JSM JSVal Source #

toJSValListOf :: [(a, b, c, d, e)] -> JSM JSVal Source #

(ToJSVal a, ToJSVal b, ToJSVal c, ToJSVal d, ToJSVal e, ToJSVal f) => ToJSVal (a, b, c, d, e, f) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b, c, d, e, f) -> JSM JSVal Source #

toJSValListOf :: [(a, b, c, d, e, f)] -> JSM JSVal Source #

(ToJSVal a, ToJSVal b, ToJSVal c, ToJSVal d, ToJSVal e, ToJSVal f, ToJSVal g) => ToJSVal (a, b, c, d, e, f, g) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

toJSVal :: (a, b, c, d, e, f, g) -> JSM JSVal Source #

toJSValListOf :: [(a, b, c, d, e, f, g)] -> JSM JSVal Source #

class FromJSVal a where Source #

Minimal complete definition

Nothing

Instances
FromJSVal Bool Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Char Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

FromJSVal Double Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Float Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Int Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Int8 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Int16 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Int32 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Word Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Word8 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Word16 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Word32 Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal () Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal Text Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

FromJSVal Value Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal JSString Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

FromJSVal JSVal Source # 
Instance details

Defined in GHCJS.Marshal

FromJSVal a => FromJSVal [a] Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

FromJSVal a => FromJSVal (Maybe a) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

(FromJSVal a, FromJSVal b) => FromJSVal (a, b) Source # 
Instance details

Defined in GHCJS.Marshal

(FromJSVal a, FromJSVal b, FromJSVal c) => FromJSVal (a, b, c) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c)] Source #

(FromJSVal a, FromJSVal b, FromJSVal c, FromJSVal d) => FromJSVal (a, b, c, d) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c, d)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c, d) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c, d)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c, d)] Source #

(FromJSVal a, FromJSVal b, FromJSVal c, FromJSVal d, FromJSVal e) => FromJSVal (a, b, c, d, e) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c, d, e)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c, d, e) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c, d, e)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c, d, e)] Source #

(FromJSVal a, FromJSVal b, FromJSVal c, FromJSVal d, FromJSVal e, FromJSVal f) => FromJSVal (a, b, c, d, e, f) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c, d, e, f)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c, d, e, f) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c, d, e, f)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c, d, e, f)] Source #

(FromJSVal a, FromJSVal b, FromJSVal c, FromJSVal d, FromJSVal e, FromJSVal f, FromJSVal g) => FromJSVal (a, b, c, d, e, f, g) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c, d, e, f, g)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c, d, e, f, g) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c, d, e, f, g)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c, d, e, f, g)] Source #

(FromJSVal a, FromJSVal b, FromJSVal c, FromJSVal d, FromJSVal e, FromJSVal f, FromJSVal g, FromJSVal h) => FromJSVal (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in GHCJS.Marshal

Methods

fromJSVal :: JSVal -> JSM (Maybe (a, b, c, d, e, f, g, h)) Source #

fromJSValUnchecked :: JSVal -> JSM (a, b, c, d, e, f, g, h) Source #

fromJSValListOf :: JSVal -> JSM (Maybe [(a, b, c, d, e, f, g, h)]) Source #

fromJSValUncheckedListOf :: JSVal -> JSM [(a, b, c, d, e, f, g, h)] Source #

class ToJSVal a => ToJSString a where Source #

Anything that can be used to make a JavaScript string

Methods

toJSString :: a -> JSString Source #

Instances
ToJSString Text Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSString String Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

ToJSString JSString Source #

If we already have a JSString we are fine

Instance details

Defined in Language.Javascript.JSaddle.Value

class FromJSVal a => FromJSString a where Source #

Anything that can be constructed from a JavaScript string

Methods

fromJSString :: JSString -> a Source #

class MakeObject this where Source #

Anything that can be used to make a JavaScript object reference

Methods

makeObject :: this -> JSM Object Source #

Instances
MakeObject JSVal Source # 
Instance details

Defined in Language.Javascript.JSaddle.Value

MakeObject Object Source #

If we already have a Object we are fine

Instance details

Defined in Language.Javascript.JSaddle.Classes.Internal

MakeObject v => MakeObject (JSM v) Source #

Object can be made by evaluating a fnction in JSM as long as it returns something we can make into a Object.

Instance details

Defined in Language.Javascript.JSaddle.Object

Methods

makeObject :: JSM v -> JSM Object Source #

class MakeArgs this where Source #

Anything that can be used to make a list of JavaScript value references for use as function arguments

Methods

makeArgs :: this -> JSM [JSVal] Source #

Instances
MakeArgs Bool Source #

Makes an argument list with just a single JavaScript boolean value

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: Bool -> JSM [JSVal] Source #

MakeArgs Double Source #

Makes an argument list with just a single JavaScript number

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: Double -> JSM [JSVal] Source #

MakeArgs () Source #

This allows us to pass no arguments easily (altenative would be to use []::[JSVal]).

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: () -> JSM [JSVal] Source #

MakeArgs Text Source #

Makes an argument list with just a single JavaScript string

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: Text -> JSM [JSVal] Source #

MakeArgs Value Source #

Makes an argument list with just a single JSON value

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: Value -> JSM [JSVal] Source #

MakeArgs JSVal Source #

A single JSVal can be used as the argument list

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: JSVal -> JSM [JSVal] Source #

MakeArgs JSCallAsFunction Source # 
Instance details

Defined in Language.Javascript.JSaddle.Object

MakeArgs JSValue Source #

Makes an argument list with just a single JavaScript value from a JSValue ADT.

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: JSValue -> JSM [JSVal] Source #

MakeArgs JSNull Source #

Makes an argument list with just a single null JavaScript value

Instance details

Defined in Language.Javascript.JSaddle.Value

Methods

makeArgs :: JSNull -> JSM [JSVal] Source #

ToJSVal arg => MakeArgs [arg] Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: [arg] -> JSM [JSVal] Source #

MakeArgs arg => MakeArgs (JSM arg) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Classes.Internal

Methods

makeArgs :: JSM arg -> JSM [JSVal] Source #

(ToJSVal arg1, ToJSVal arg2) => MakeArgs (arg1, arg2) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: (arg1, arg2) -> JSM [JSVal] Source #

(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3) => MakeArgs (arg1, arg2, arg3) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: (arg1, arg2, arg3) -> JSM [JSVal] Source #

(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4) => MakeArgs (arg1, arg2, arg3, arg4) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: (arg1, arg2, arg3, arg4) -> JSM [JSVal] Source #

(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5) => MakeArgs (arg1, arg2, arg3, arg4, arg5) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: (arg1, arg2, arg3, arg4, arg5) -> JSM [JSVal] Source #

(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5, ToJSVal arg6) => MakeArgs (arg1, arg2, arg3, arg4, arg5, arg6) Source # 
Instance details

Defined in Language.Javascript.JSaddle.Arguments

Methods

makeArgs :: (arg1, arg2, arg3, arg4, arg5, arg6) -> JSM [JSVal] Source #