fay- A compiler for Fay, a Haskell subset that compiles to JavaScript.

Safe HaskellNone



Handles variable bindings on the module level and also keeps track of primitive operations that we want to treat specially.



data ModuleScope Source

Maps names bound in the module to their real names The keys are unqualified for locals and imports, the values are always fully qualified Example contents: [ (UnQUal main , Qual Main main) , (UnQual take , Qual Prelude take) , ( Qual M insertWith, Qual Data.Map insertWith) ]

bindAsLocals :: [QName] -> ModuleScope -> ModuleScopeSource

Bind a list of names into the local scope Right now all bindings are made unqualified

findTopLevelNames :: ModuleName -> [Decl] -> ModuleScopeSource

Get module level names from a haskell module AST.

resolveName :: QName -> ModuleScope -> Maybe QNameSource

Find the path of a locally bound name Returns special values in the Fay$ module for primOps

moduleLocals :: ModuleName -> ModuleScope -> [QName]Source

Find all names that are bound locally in this module, which excludes imports.