jsaddle-0.9.2.1: 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 #

Minimal complete definition

pToJSVal

Methods

pToJSVal :: a -> JSVal Source #

class PFromJSVal a where Source #

Minimal complete definition

pFromJSVal

Methods

pFromJSVal :: JSVal -> a Source #

class ToJSVal a where Source #

Methods

toJSVal :: a -> JSM JSVal Source #

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

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

Instances

class ToJSVal a => ToJSString a where Source #

Anything that can be used to make a JavaScript string

Minimal complete definition

toJSString

Methods

toJSString :: a -> JSString Source #

class FromJSVal a => FromJSString a where Source #

Anything that can be constructed from a JavaScript string

Minimal complete definition

fromJSString

Methods

fromJSString :: JSString -> a Source #

class MakeObject this where Source #

Anything that can be used to make a JavaScript object reference

Minimal complete definition

makeObject

Methods

makeObject :: this -> JSM Object Source #

Instances

MakeObject Object Source #

If we already have a Object we are fine

class MakeArgs this where Source #

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

Minimal complete definition

makeArgs

Methods

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

Instances

MakeArgs JSValue Source #

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

Methods

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

MakeArgs JSNull Source #

Makes an argument list with just a single null JavaScript value

Methods

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

MakeArgs arg => MakeArgs (JSM arg) Source # 

Methods

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