Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility combinator functions for simplifying writing programmatic generation of ECMAScript code. Recommended to use together with the -XOverloadedStrings GHC extension.
Synopsis
- script :: Default a => [Statement a] -> JavaScript a
- ident :: Default a => String -> Id a
- propId :: Default a => Id a -> Prop a
- propS :: Default a => String -> Prop a
- propN :: Default a => Integer -> Prop a
- lvar :: Default a => String -> LValue a
- ldot :: Default a => Expression a -> String -> LValue a
- lbrack :: Default a => Expression a -> Expression a -> LValue a
- string :: Default a => String -> Expression a
- regexp :: Default a => String -> Bool -> Bool -> Expression a
- number :: Default a => Double -> Expression a
- bool :: Default a => Bool -> Expression a
- int :: Default a => Int -> Expression a
- null_ :: Default a => Expression a
- array :: Default a => [Expression a] -> Expression a
- object :: Default a => [(Prop a, Expression a)] -> Expression a
- this :: Default a => Expression a
- var :: Default a => Id a -> Expression a
- dot :: Default a => Expression a -> Id a -> Expression a
- brack :: Default a => Expression a -> Expression a -> Expression a
- new :: Default a => Expression a -> [Expression a] -> Expression a
- prefix :: Default a => PrefixOp -> Expression a -> Expression a
- lnot :: Default a => Expression a -> Expression a
- bnot :: Default a => Expression a -> Expression a
- plus :: Default a => Expression a -> Expression a
- minus :: Default a => Expression a -> Expression a
- typeof :: Default a => Expression a -> Expression a
- void :: Default a => Expression a -> Expression a
- delete :: Default a => Expression a -> Expression a
- uassign :: Default a => UnaryAssignOp -> LValue a -> Expression a
- preinc :: Default a => LValue a -> Expression a
- predec :: Default a => LValue a -> Expression a
- postinc :: Default a => LValue a -> Expression a
- postdec :: Default a => LValue a -> Expression a
- infixe :: Default a => InfixOp -> Expression a -> Expression a -> Expression a
- lt :: Default a => Expression a -> Expression a -> Expression a
- le :: Default a => Expression a -> Expression a -> Expression a
- gt :: Default a => Expression a -> Expression a -> Expression a
- ge :: Default a => Expression a -> Expression a -> Expression a
- in_ :: Default a => Expression a -> Expression a -> Expression a
- instanceof :: Default a => Expression a -> Expression a -> Expression a
- eq :: Default a => Expression a -> Expression a -> Expression a
- neq :: Default a => Expression a -> Expression a -> Expression a
- steq :: Default a => Expression a -> Expression a -> Expression a
- stneq :: Default a => Expression a -> Expression a -> Expression a
- land :: Default a => Expression a -> Expression a -> Expression a
- lor :: Default a => Expression a -> Expression a -> Expression a
- mul :: Default a => Expression a -> Expression a -> Expression a
- div :: Default a => Expression a -> Expression a -> Expression a
- mod :: Default a => Expression a -> Expression a -> Expression a
- sub :: Default a => Expression a -> Expression a -> Expression a
- lshift :: Default a => Expression a -> Expression a -> Expression a
- srshift :: Default a => Expression a -> Expression a -> Expression a
- zrshift :: Default a => Expression a -> Expression a -> Expression a
- band :: Default a => Expression a -> Expression a -> Expression a
- bor :: Default a => Expression a -> Expression a -> Expression a
- xor :: Default a => Expression a -> Expression a -> Expression a
- add :: Default a => Expression a -> Expression a -> Expression a
- cond :: Default a => Expression a -> Expression a -> Expression a -> Expression a
- assignop :: Default a => AssignOp -> LValue a -> Expression a -> Expression a
- assign :: Default a => LValue a -> Expression a -> Expression a
- assignadd :: Default a => LValue a -> Expression a -> Expression a
- assignsub :: Default a => LValue a -> Expression a -> Expression a
- assignmul :: Default a => LValue a -> Expression a -> Expression a
- assigndiv :: Default a => LValue a -> Expression a -> Expression a
- assignmod :: Default a => LValue a -> Expression a -> Expression a
- assignlshift :: Default a => LValue a -> Expression a -> Expression a
- assignsrshift :: Default a => LValue a -> Expression a -> Expression a
- assignzrshift :: Default a => LValue a -> Expression a -> Expression a
- assignband :: Default a => LValue a -> Expression a -> Expression a
- assignxor :: Default a => LValue a -> Expression a -> Expression a
- assignbor :: Default a => LValue a -> Expression a -> Expression a
- list :: Default a => [Expression a] -> Expression a
- call :: Default a => Expression a -> [Expression a] -> Expression a
- func :: Default a => Id a -> [Id a] -> [Statement a] -> Expression a
- lambda :: Default a => [Id a] -> [Statement a] -> Expression a
- casee :: Default a => Expression a -> [Statement a] -> CaseClause a
- defaultc :: Default a => [Statement a] -> CaseClause a
- catch :: Default a => Id a -> Statement a -> CatchClause a
- vardecl :: Default a => Id a -> VarDecl a
- varinit :: Default a => Id a -> Expression a -> VarDecl a
- block :: Default a => [Statement a] -> Statement a
- empty :: Default a => Statement a
- expr :: Default a => Expression a -> Statement a
- ifte :: Default a => Expression a -> Statement a -> Statement a -> Statement a
- ift :: Default a => Expression a -> Statement a -> Statement a
- switch :: Default a => Expression a -> [CaseClause a] -> Statement a
- while :: Default a => Expression a -> Statement a -> Statement a
- dowhile :: Default a => Statement a -> Expression a -> Statement a
- break :: Default a => Maybe (Id a) -> Statement a
- continue :: Default a => Maybe (Id a) -> Statement a
- label :: Default a => Id a -> Statement a -> Statement a
- forin :: Default a => ForInInit a -> Expression a -> Statement a -> Statement a
- for :: Default a => ForInit a -> Maybe (Expression a) -> Maybe (Expression a) -> Statement a -> Statement a
- try :: Default a => Statement a -> Statement a
- trycatch :: Default a => Statement a -> CatchClause a -> Maybe (Statement a) -> Statement a
- tryfinally :: Default a => Statement a -> Statement a -> Statement a
- trycatchfinally :: Default a => Statement a -> CatchClause a -> Statement a -> Statement a
- throw :: Default a => Expression a -> Statement a
- returns :: Default a => Expression a -> Statement a
- ret :: Default a => Statement a
- with :: Default a => Expression a -> Statement a -> Statement a
- vardecls :: Default a => [VarDecl a] -> Statement a
- function :: Default a => Id a -> [Id a] -> [Statement a] -> Statement a
- id2string :: Id a -> Expression a
- lv2e :: LValue a -> Expression a
- e2lv :: Expression a -> LValue a
- forInInit2lv :: ForInInit a -> LValue a
Documentation
lbrack :: Default a => Expression a -> Expression a -> LValue a Source #
null_ :: Default a => Expression a Source #
array :: Default a => [Expression a] -> Expression a Source #
object :: Default a => [(Prop a, Expression a)] -> Expression a Source #
this :: Default a => Expression a Source #
dot :: Default a => Expression a -> Id a -> Expression a Source #
brack :: Default a => Expression a -> Expression a -> Expression a Source #
new :: Default a => Expression a -> [Expression a] -> Expression a Source #
prefix :: Default a => PrefixOp -> Expression a -> Expression a Source #
lnot :: Default a => Expression a -> Expression a Source #
bnot :: Default a => Expression a -> Expression a Source #
plus :: Default a => Expression a -> Expression a Source #
minus :: Default a => Expression a -> Expression a Source #
typeof :: Default a => Expression a -> Expression a Source #
void :: Default a => Expression a -> Expression a Source #
delete :: Default a => Expression a -> Expression a Source #
uassign :: Default a => UnaryAssignOp -> LValue a -> Expression a Source #
infixe :: Default a => InfixOp -> Expression a -> Expression a -> Expression a Source #
lt :: Default a => Expression a -> Expression a -> Expression a Source #
le :: Default a => Expression a -> Expression a -> Expression a Source #
gt :: Default a => Expression a -> Expression a -> Expression a Source #
ge :: Default a => Expression a -> Expression a -> Expression a Source #
in_ :: Default a => Expression a -> Expression a -> Expression a Source #
instanceof :: Default a => Expression a -> Expression a -> Expression a Source #
eq :: Default a => Expression a -> Expression a -> Expression a Source #
neq :: Default a => Expression a -> Expression a -> Expression a Source #
steq :: Default a => Expression a -> Expression a -> Expression a Source #
stneq :: Default a => Expression a -> Expression a -> Expression a Source #
land :: Default a => Expression a -> Expression a -> Expression a Source #
lor :: Default a => Expression a -> Expression a -> Expression a Source #
mul :: Default a => Expression a -> Expression a -> Expression a Source #
div :: Default a => Expression a -> Expression a -> Expression a Source #
mod :: Default a => Expression a -> Expression a -> Expression a Source #
sub :: Default a => Expression a -> Expression a -> Expression a Source #
lshift :: Default a => Expression a -> Expression a -> Expression a Source #
srshift :: Default a => Expression a -> Expression a -> Expression a Source #
zrshift :: Default a => Expression a -> Expression a -> Expression a Source #
band :: Default a => Expression a -> Expression a -> Expression a Source #
bor :: Default a => Expression a -> Expression a -> Expression a Source #
xor :: Default a => Expression a -> Expression a -> Expression a Source #
add :: Default a => Expression a -> Expression a -> Expression a Source #
cond :: Default a => Expression a -> Expression a -> Expression a -> Expression a Source #
assignop :: Default a => AssignOp -> LValue a -> Expression a -> Expression a Source #
assign :: Default a => LValue a -> Expression a -> Expression a Source #
assignadd :: Default a => LValue a -> Expression a -> Expression a Source #
assignsub :: Default a => LValue a -> Expression a -> Expression a Source #
assignmul :: Default a => LValue a -> Expression a -> Expression a Source #
assigndiv :: Default a => LValue a -> Expression a -> Expression a Source #
assignmod :: Default a => LValue a -> Expression a -> Expression a Source #
assignlshift :: Default a => LValue a -> Expression a -> Expression a Source #
assignsrshift :: Default a => LValue a -> Expression a -> Expression a Source #
assignzrshift :: Default a => LValue a -> Expression a -> Expression a Source #
assignband :: Default a => LValue a -> Expression a -> Expression a Source #
assignxor :: Default a => LValue a -> Expression a -> Expression a Source #
assignbor :: Default a => LValue a -> Expression a -> Expression a Source #
list :: Default a => [Expression a] -> Expression a Source #
call :: Default a => Expression a -> [Expression a] -> Expression a Source #
casee :: Default a => Expression a -> [Statement a] -> CaseClause a Source #
switch :: Default a => Expression a -> [CaseClause a] -> Statement a Source #
for :: Default a => ForInit a -> Maybe (Expression a) -> Maybe (Expression a) -> Statement a -> Statement a Source #
trycatch :: Default a => Statement a -> CatchClause a -> Maybe (Statement a) -> Statement a Source #
trycatchfinally :: Default a => Statement a -> CatchClause a -> Statement a -> Statement a Source #
id2string :: Id a -> Expression a Source #
Convert an identifier to a String literal
lv2e :: LValue a -> Expression a Source #
Helper function to convert LValues to expressions
e2lv :: Expression a -> LValue a Source #
Convert an expression to an l-value. May fail with an error
forInInit2lv :: ForInInit a -> LValue a Source #
Orphan instances
Default a => IsString (Expression a) Source # | |
fromString :: String -> Expression a # | |
Default a => IsString (LValue a) Source # | |
fromString :: String -> LValue a # | |
Default a => IsString (Prop a) Source # | |
fromString :: String -> Prop a # | |
Default a => IsString (Id a) Source # | |
fromString :: String -> Id a # |