Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- class PToJSVal a where
- class PFromJSVal a where
- class ToJSVal a where
- class FromJSVal a where
- class ToJSVal a => ToJSString a where
- class FromJSVal a => FromJSString a where
- class MakeObject this where
- class MakeArgs this where
Type classes to convert Haskell data to JavaScript
class PFromJSVal a where Source #
pFromJSVal :: JSVal -> a Source #
Instances
PFromJSVal () Source # | |
Defined in GHCJS.Marshal.Pure pFromJSVal :: JSVal -> () Source # | |
PFromJSVal JSVal Source # | |
Defined in GHCJS.Marshal.Pure pFromJSVal :: JSVal -> JSVal Source # | |
PFromJSVal MutableArrayBuffer Source # | |
Defined in JavaScript.TypedArray.ArrayBuffer.Internal pFromJSVal :: JSVal -> MutableArrayBuffer Source # |
class ToJSVal a where Source #
toJSVal :: a -> JSM JSVal Source #
toJSValListOf :: [a] -> JSM JSVal Source #
toJSVal :: (Generic a, GToJSVal (Rep a ())) => a -> JSM JSVal Source #
Instances
class FromJSVal a where Source #
fromJSVal :: JSVal -> JSM (Maybe a) Source #
fromJSValUnchecked :: JSVal -> JSM a Source #
fromJSValListOf :: JSVal -> JSM (Maybe [a]) Source #
fromJSValUncheckedListOf :: JSVal -> JSM [a] Source #
fromJSVal :: (Generic a, GFromJSVal (Rep a ())) => JSVal -> JSM (Maybe a) Source #
Instances
class ToJSVal a => ToJSString a where Source #
Anything that can be used to make a JavaScript string
toJSString :: a -> JSString Source #
Instances
ToJSString String Source # | |
Defined in Language.Javascript.JSaddle.Value toJSString :: String -> JSString Source # | |
ToJSString Text Source # | |
Defined in Language.Javascript.JSaddle.Value toJSString :: Text -> JSString Source # | |
ToJSString JSString Source # | If we already have a JSString we are fine |
Defined in Language.Javascript.JSaddle.Value toJSString :: JSString -> JSString Source # |
class FromJSVal a => FromJSString a where Source #
Anything that can be constructed from a JavaScript string
fromJSString :: JSString -> a Source #
Instances
FromJSString String Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> String Source # | |
FromJSString Text Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> Text Source # | |
FromJSString JSString Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> JSString Source # |
class MakeObject this where Source #
Anything that can be used to make a JavaScript object reference
makeObject :: this -> JSM Object Source #
Instances
MakeObject JSVal Source # | |
Defined in Language.Javascript.JSaddle.Value | |
MakeObject Object Source # | If we already have a Object we are fine |
Defined in Language.Javascript.JSaddle.Classes.Internal | |
MakeObject v => MakeObject (JSM v) Source # | Object can be made by evaluating a fnction in |
Defined in Language.Javascript.JSaddle.Object |
class MakeArgs this where Source #
Anything that can be used to make a list of JavaScript value references for use as function arguments
Instances
MakeArgs Bool Source # | Makes an argument list with just a single JavaScript boolean value |
MakeArgs Double Source # | Makes an argument list with just a single JavaScript number |
MakeArgs () Source # | This allows us to pass no arguments easily (altenative would be to use |
MakeArgs Text Source # | Makes an argument list with just a single JavaScript string |
MakeArgs Value Source # | Makes an argument list with just a single JSON value |
MakeArgs JSVal Source # | A single JSVal can be used as the argument list |
MakeArgs JSCallAsFunction Source # | |
Defined in Language.Javascript.JSaddle.Object | |
MakeArgs JSValue Source # | Makes an argument list with just a single JavaScript value from a |
MakeArgs JSNull Source # | Makes an argument list with just a single |
ToJSVal arg => MakeArgs [arg] Source # | |
MakeArgs arg => MakeArgs (JSM arg) Source # | |
(ToJSVal arg1, ToJSVal arg2) => MakeArgs (arg1, arg2) Source # | |
(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3) => MakeArgs (arg1, arg2, arg3) Source # | |
(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4) => MakeArgs (arg1, arg2, arg3, arg4) Source # | |
(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5) => MakeArgs (arg1, arg2, arg3, arg4, arg5) Source # | |
(ToJSVal arg1, ToJSVal arg2, ToJSVal arg3, ToJSVal arg4, ToJSVal arg5, ToJSVal arg6) => MakeArgs (arg1, arg2, arg3, arg4, arg5, arg6) Source # | |