| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
FreeC.IR.Syntax.Module
Description
This module contains the definition of modules of our intermediate language.
Synopsis
- data ModuleOf contents = ModuleOf {
- modSrcSpan :: SrcSpan
- modName :: ModName
- modImports :: [ImportDecl]
- modPragmas :: [Pragma]
- modContents :: contents
- modWithContents :: (contents -> contents') -> ModuleOf contents -> ModuleOf contents'
- type Module = ModuleOf [TopLevelDecl]
- data ImportDecl = ImportDecl {}
- data TopLevelDecl
- = TopLevelTypeDecl { }
- | TopLevelTypeSig { }
- | TopLevelFuncDecl { }
- isTopLevelTypeDecl :: TopLevelDecl -> Bool
- isTopLevelTypeSig :: TopLevelDecl -> Bool
- isTopLevelFuncDecl :: TopLevelDecl -> Bool
- modTypeDecls :: Module -> [TypeDecl]
- modWithTypeDecls :: [TypeDecl] -> Module -> Module
- modTypeSigs :: Module -> [TypeSig]
- modWithTypeSigs :: [TypeSig] -> Module -> Module
- modFuncDecls :: Module -> [FuncDecl]
- modWithFuncDecls :: [FuncDecl] -> Module -> Module
Documentation
data ModuleOf contents Source #
A module declaration that contains declarations of type contents.
This type is used for example to represent partially transformed modules where only the name, imports and pragmas of the module are transformed into the intermediate representation.
Constructors
| ModuleOf | |
Fields
| |
Instances
| Eq contents => Eq (ModuleOf contents) Source # | |
| Show contents => Show (ModuleOf contents) Source # | |
| Pretty contents => Pretty (ModuleOf [contents]) Source # | Pretty instance for modules. |
Defined in FreeC.IR.Syntax.Module | |
| StripExprType contents => StripExprType (ModuleOf contents) Source # | Strips the expression type annotations from all declarations in a module. |
Defined in FreeC.IR.Strip Methods stripExprType :: ModuleOf contents -> ModuleOf contents Source # | |
| Similar contents => Similar (ModuleOf contents) Source # | Two modules are similar if their names and contents are similar. |
Defined in FreeC.IR.Similar | |
| Parseable (ModuleOf [TopLevelDecl]) Source # | Modules can be parsed. |
Defined in FreeC.Frontend.IR.Parser Methods parseIR' :: Parser (ModuleOf [TopLevelDecl]) Source # | |
modWithContents :: (contents -> contents') -> ModuleOf contents -> ModuleOf contents' Source #
Applies the given function to the contents of the given module.
type Module = ModuleOf [TopLevelDecl] Source #
A module declaration.
data ImportDecl Source #
An import declaration.
Constructors
| ImportDecl | |
Fields | |
Instances
| Eq ImportDecl Source # | |
Defined in FreeC.IR.Syntax.Module Methods (==) :: ImportDecl -> ImportDecl -> Bool Source # (/=) :: ImportDecl -> ImportDecl -> Bool Source # | |
| Show ImportDecl Source # | |
Defined in FreeC.IR.Syntax.Module | |
| Pretty ImportDecl Source # | Pretty instance for import declarations. |
Defined in FreeC.IR.Syntax.Module | |
| Similar ImportDecl Source # | Two import declarations are similar if they import the same module. |
Defined in FreeC.IR.Similar Methods similar' :: ImportDecl -> ImportDecl -> Renaming -> Bool | |
| Parseable ImportDecl Source # | Import declarations can be parsed. |
Defined in FreeC.Frontend.IR.Parser Methods parseIR' :: Parser ImportDecl Source # | |
data TopLevelDecl Source #
Declarations that can occur on top-level of a Module declaration.
Constructors
| TopLevelTypeDecl | |
Fields | |
| TopLevelTypeSig | |
Fields | |
| TopLevelFuncDecl | |
Fields | |
Instances
| Eq TopLevelDecl Source # | |
Defined in FreeC.IR.Syntax.Module Methods (==) :: TopLevelDecl -> TopLevelDecl -> Bool Source # (/=) :: TopLevelDecl -> TopLevelDecl -> Bool Source # | |
| Show TopLevelDecl Source # | |
Defined in FreeC.IR.Syntax.Module | |
| Pretty TopLevelDecl Source # | Pretty instance for top-level declarations. |
Defined in FreeC.IR.Syntax.Module | |
| StripExprType TopLevelDecl Source # | Strips the expression type annotations from top-level function declarations. |
Defined in FreeC.IR.Strip Methods | |
| Similar TopLevelDecl Source # | Only top-level declarations of the same type can be similar. |
Defined in FreeC.IR.Similar Methods similar' :: TopLevelDecl -> TopLevelDecl -> Renaming -> Bool | |
| Parseable (ModuleOf [TopLevelDecl]) Source # | Modules can be parsed. |
Defined in FreeC.Frontend.IR.Parser Methods parseIR' :: Parser (ModuleOf [TopLevelDecl]) Source # | |
isTopLevelTypeDecl :: TopLevelDecl -> Bool Source #
Tests whether the given top-level declaration is a TypeDecl.
isTopLevelTypeSig :: TopLevelDecl -> Bool Source #
Tests whether the given top-level declaration is a TypeSig.
isTopLevelFuncDecl :: TopLevelDecl -> Bool Source #
Tests whether the given top-level declaration is a FuncDecl.
modTypeDecls :: Module -> [TypeDecl] Source #
Gets the type declarations of the given module.
modWithTypeDecls :: [TypeDecl] -> Module -> Module Source #
Sets the type declarations of the given module.
All other type declarations are discarded.
modTypeSigs :: Module -> [TypeSig] Source #
Gets the type signatures of the given module.
modWithTypeSigs :: [TypeSig] -> Module -> Module Source #
Sets the type signatures of the given module.
All other type signatures are discarded.
modFuncDecls :: Module -> [FuncDecl] Source #
Gets the function declarations of the given module.