sunroof-compiler-0.2: Monadic Javascript Compiler

Safe HaskellNone



JSMap provides an abstract and more type-safe access to maps in JavaScript. It is a wrapper around the dictionary each object in JavaScript is.



data JSMap k a Source

JSMap abstraction. The first type parameter gives the type of keys used by the name and the second gives the type of values.


(SunroofKey k, Sunroof a) => Show (JSMap k a) 
(SunroofKey k, Sunroof a) => IfB (JSMap k a) 
(SunroofKey k, Sunroof a) => Sunroof (JSMap k a) 

newMap :: JS t (JSMap k a)Source

Create a new empty JSMap.

insert :: (SunroofKey k, Sunroof a) => k -> a -> JSMap k a -> JS t ()Source

insert k x inserts an element x associated with the given key k into a map.

lookup' :: (SunroofKey k, Sunroof a) => k -> JSMap k a -> JS t aSource

lookup k selects the value associated with the key k.