| Safe Haskell | None | 
|---|
Language.Sunroof.JavaScript
Description
Basic low-level types and their combinators. These are used as output of the compiler. Everything here is untypes and not supposed for public use!
- type Expr = E ExprE
 - data ExprE = ExprE Expr
 - data E expr
 - type Id = String
 - data  Stmt 
- = AssignStmt Rhs Expr
 - | DeleteStmt Expr
 - | ExprStmt Expr
 - | ReturnStmt Expr
 - | IfStmt Expr [Stmt] [Stmt]
 - | WhileStmt Expr [Stmt]
 - | CommentStmt String
 
 - data Type
 - data Rhs
 - showExpr :: Bool -> Expr -> String
 - showStmt :: Stmt -> String
 - operator :: Id -> [Expr] -> Expr
 - binOp :: String -> Expr -> Expr -> E ExprE
 - uniOp :: String -> Expr -> E ExprE
 - literal :: String -> Expr
 - scopeForEffect :: [Stmt] -> Expr
 
Documentation
Plain expressions in Javascript.
Constructors
| Lit String | A precompiled (atomic) Javascript literal.  | 
| Var Id | A variable.  | 
| Dot expr expr Type | Field/attribute access (with type information):   | 
| Apply expr [expr] | Function application:   | 
| Function [Id] [Stmt] | Anonymous function with parameter names and body.  | 
Plain Javascript statements.
Constructors
| AssignStmt Rhs Expr | Restricted assignment:   | 
| DeleteStmt Expr | Delete reference   | 
| ExprStmt Expr | Expression statement, for the sake of its side effects:   | 
| ReturnStmt Expr | Return statement:   | 
| IfStmt Expr [Stmt] [Stmt] | If-Then-Else statement:   | 
| WhileStmt Expr [Stmt] | While loop:   | 
| CommentStmt String | A comment in the code:   | 
Abstract types for Javascript expressions in Sunroof.
A Right hand side of an assignment.
showExpr :: Bool -> Expr -> StringSource
Show an expression as compiled Javascript. The boolean argument says non-trivial arguments need parenthesis.
operator :: Id -> [Expr] -> ExprSource
Combinator to create a operator/function applied to the given arguments.
binOp :: String -> Expr -> Expr -> E ExprESource
Short-hand to create the applied binary operator/function.
   See operator.
uniOp :: String -> Expr -> E ExprESource
Short-hand to create the applied unary operator/function.
   See operator.
literal :: String -> ExprSource
Combinator to create a expression containing a literal in form of a string.
scopeForEffect :: [Stmt] -> ExprSource
Create a anonymous function to scope all effects in the given block of statement.