Safe Haskell | Safe-Inferred |
---|---|
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
- pFromJSVal :: JSVal -> a
- class ToJSVal a where
- class FromJSVal a where
- fromJSVal :: JSVal -> JSM (Maybe a)
- fromJSValUnchecked :: JSVal -> JSM a
- fromJSValListOf :: JSVal -> JSM (Maybe [a])
- fromJSValUncheckedListOf :: JSVal -> JSM [a]
- class ToJSVal a => ToJSString a where
- toJSString :: a -> JSString
- class FromJSVal a => FromJSString a where
- fromJSString :: JSString -> a
- class MakeObject this where
- makeObject :: this -> JSM Object
- class MakeArgs this where
Type classes to convert Haskell data to JavaScript
class PFromJSVal a where Source #
pFromJSVal :: JSVal -> a Source #
Instances
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 # | |
PFromJSVal () Source # | |
Defined in GHCJS.Marshal.Pure pFromJSVal :: JSVal -> () Source # |
class ToJSVal a where Source #
Nothing
Instances
class FromJSVal a where Source #
Nothing
fromJSVal :: JSVal -> JSM (Maybe a) Source #
fromJSValUnchecked :: JSVal -> JSM a Source #
fromJSValListOf :: JSVal -> JSM (Maybe [a]) Source #
fromJSValUncheckedListOf :: JSVal -> JSM [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 JSString Source # | If we already have a JSString we are fine |
Defined in Language.Javascript.JSaddle.Value toJSString :: JSString -> JSString Source # | |
ToJSString Text Source # | |
Defined in Language.Javascript.JSaddle.Value toJSString :: Text -> JSString Source # | |
ToJSString String Source # | |
Defined in Language.Javascript.JSaddle.Value toJSString :: String -> JSString Source # |
class FromJSVal a => FromJSString a where Source #
Anything that can be constructed from a JavaScript string
fromJSString :: JSString -> a Source #
Instances
FromJSString JSString Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> JSString Source # | |
FromJSString Text Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> Text Source # | |
FromJSString String Source # | |
Defined in Language.Javascript.JSaddle.Value fromJSString :: JSString -> String 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 function 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 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 JSNull Source # | Makes an argument list with just a single |
MakeArgs JSValue Source # | Makes an argument list with just a single JavaScript value from a |
MakeArgs Text Source # | Makes an argument list with just a single JavaScript string |
MakeArgs () Source # | This allows us to pass no arguments easily (altenative would be to use |
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 arg => MakeArgs (JSM arg) Source # | |
ToJSVal arg => MakeArgs [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 # | |