language-ecmascript-0.17.2.0: JavaScript parser and pretty-printer library

Safe HaskellNone
LanguageHaskell2010

Language.ECMAScript3.Syntax.CodeGen

Contents

Description

Utility combinator functions for simplifying writing programmatic generation of ECMAScript code. Recommended to use together with the -XOverloadedStrings GHC extension.

Synopsis

Documentation

ident :: Default a => String -> Id a Source #

propId :: Default a => Id a -> Prop a Source #

var :: Default a => Id a -> Expression a Source #

dot :: Default a => Expression a -> Id a -> Expression a Source #

func :: Default a => Id a -> [Id a] -> [Statement a] -> Expression a Source #

lambda :: Default a => [Id a] -> [Statement a] -> Expression a Source #

vardecl :: Default a => Id a -> VarDecl a Source #

label :: Default a => Id a -> Statement a -> Statement a Source #

function :: Default a => Id a -> [Id 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

Orphan instances

Default a => IsString (Expression a) Source # 

Methods

fromString :: String -> Expression a #

Default a => IsString (LValue a) Source # 

Methods

fromString :: String -> LValue a #

Default a => IsString (Prop a) Source # 

Methods

fromString :: String -> Prop a #

Default a => IsString (Id a) Source # 

Methods

fromString :: String -> Id a #