Safe Haskell | None |
---|
Miscellaneous functions used throughout the compiler.
- unname :: Name -> String
- fayBuiltin :: String -> QName
- thunk :: JsExp -> JsExp
- stmtsThunk :: [JsStmt] -> JsExp
- uniqueNames :: [JsName]
- resolveName :: QName -> Compile QName
- simpleImport :: NameScope -> Bool
- qualify :: Name -> Compile QName
- bindToplevel :: SrcLoc -> Bool -> Name -> JsExp -> Compile JsStmt
- withScope :: Compile a -> Compile a
- generateScope :: Compile a -> Compile ()
- bindVar :: Name -> Compile ()
- emitExport :: ExportSpec -> Compile ()
- force :: JsExp -> JsExp
- isConstant :: JsExp -> Bool
- parseResult :: ((SrcLoc, String) -> b) -> (a -> b) -> ParseResult a -> b
- config :: (CompileConfig -> a) -> Compile a
- optimizePatConditions :: [[JsStmt]] -> [[JsStmt]]
- throw :: String -> JsExp -> JsStmt
- throwExp :: String -> JsExp -> JsExp
- isWildCardAlt :: Alt -> Bool
- isWildCardPat :: Pat -> Bool
- withScopedTmpJsName :: (JsName -> Compile a) -> Compile a
- withScopedTmpName :: (Name -> Compile a) -> Compile a
Documentation
fayBuiltin :: String -> QNameSource
Make an identifier from the built-in HJ module.
stmtsThunk :: [JsStmt] -> JsExpSource
Wrap an expression in a thunk.
uniqueNames :: [JsName]Source
Generate unique names.
resolveName :: QName -> Compile QNameSource
Resolve a given maybe-qualified name to a fully qualifed name.
simpleImport :: NameScope -> BoolSource
Do have have a simple import X import on our hands?
withScope :: Compile a -> Compile aSource
Create a temporary scope and discard it after the given computation.
generateScope :: Compile a -> Compile ()Source
Run a compiler and just get the scope information.
emitExport :: ExportSpec -> Compile ()Source
Emit exported names.
isConstant :: JsExp -> BoolSource
Is a JS expression a literal (constant)?
parseResult :: ((SrcLoc, String) -> b) -> (a -> b) -> ParseResult a -> bSource
Extract the string from a qname. qname :: QName -> String qname (UnQual (Ident str)) = str qname (UnQual (Symbol sym)) = jsEncodeName sym qname i = error $ qname: Expected unqualified ident, found: ++ show i -- FIXME:
Deconstruct a parse result (a la maybe, foldr, either).
config :: (CompileConfig -> a) -> Compile aSource
Get a config option.
optimizePatConditions :: [[JsStmt]] -> [[JsStmt]]Source
Optimize pattern matching conditions by merging conditions in common.
isWildCardAlt :: Alt -> BoolSource
Is an alt a wildcard?
isWildCardPat :: Pat -> BoolSource
Is a pattern a wildcard?
withScopedTmpJsName :: (JsName -> Compile a) -> Compile aSource
Generate a temporary, SCOPED name for testing conditions and such.
withScopedTmpName :: (Name -> Compile a) -> Compile aSource
Generate a temporary, SCOPED name for testing conditions and such. We don't have name tracking yet, so instead we use this.