haste-compiler- Haskell To ECMAScript compiler

Safe HaskellNone



Dealing with JavaScript objects on a low, low level.



type JSObj = Maybe JSAny Source

A JS object: either null/undefined or Just an actual value.

data Type Source

Possible types of JS objects.

(#) :: JSLookup a => a -> JSString -> IO JSObj infixl 4 Source

Look up a property on an object-like value.

asString :: JSObj -> IO (Maybe JSString) Source

Convert the object to a JSString.

asBool :: JSObj -> IO (Maybe Bool) Source

Convert the object to a Bool.

asNumber :: JSObj -> IO (Maybe Double) Source

Convert the object to a Double.

typeOf :: JSObj -> IO Type Source

Get the type of a JS object.

lookupPath :: JSObj -> [JSString] -> IO JSObj Source

Lookup a whole path at once. More efficient for long paths. x lookupPath ["a", "b"] is equivalent to x.a.b.

toObject :: [(JSString, JSAny)] -> JSAny Source

Build a new JS object from a list of key:value pairs.