haste-compiler-0.2.99: Haskell To ECMAScript compiler

Safe HaskellNone

Haste.JSON

Description

Haste-specific JSON library. JSON is common enough that it's a good idea to create as fast and small an implementation as possible. To that end, the parser is implemented entirely in Javascript, and works with any browser that supports JSON.parse; IE does this from version 8 and up, and everyone else has done it since just about forever.

Synopsis

Documentation

data JSON Source

Constructors

Num Double 
Str JSString 
Bool Bool 
Arr [JSON] 
Dict [(JSString, JSON)] 

Instances

Num JSON

This instance may be a bad idea, but it's nice to be able to create JSOn objects using plain numeric literals.

Show JSON 
IsString JSON 
Serialize JSON 
AjaxData JSON 

(!) :: JSON -> JSString -> JSONSource

Look up a JSON object from a JSON dictionary. Panics if the dictionary isn't a dictionary, or if it doesn't contain the given key.

(~>) :: JSONLookup a => a -> JSString -> Maybe JSONSource

Look up a key in a JSON dictionary. Return Nothing if the key can't be found for some reason.