Portability | GHC-only |
---|---|
Stability | experimental |
Maintainer | Fontaine@cs.uni-duesseldorf.de |
Compute the mapping between the using occurences and the defining occurences of all Identifier in a Module Also decide whether to use ground or non-ground- representaions for the translation to Prolog.
- renameModule :: ModuleFromParser -> Either RenameError (ModuleFromRenaming, RenameInfo)
- getRenaming :: ModuleFromParser -> Either RenameError (Bindings, AstAnnotation UniqueIdent, AstAnnotation UniqueIdent)
- applyRenaming :: (Bindings, AstAnnotation UniqueIdent, AstAnnotation UniqueIdent) -> ModuleFromParser -> ModuleFromRenaming
- data RenameError = RenameError {}
- data RenameInfo = RenameInfo {}
- type ModuleFromRenaming = Module FromRenaming
- data FromRenaming
Documentation
renameModule :: ModuleFromParser -> Either RenameError (ModuleFromRenaming, RenameInfo)Source
renameModule
renames a Module
.
| (also calls mergeFunBinds)
getRenaming :: ModuleFromParser -> Either RenameError (Bindings, AstAnnotation UniqueIdent, AstAnnotation UniqueIdent)Source
getRenaming
computes two AstAnnotation
s.
The first one contains all the defining occurences of identifier
The second one contains all the using occurences of identitier.
getRename
returns an RenameError
if the Module
contains unbound
identifiers or illegal redefinitions.
applyRenaming :: (Bindings, AstAnnotation UniqueIdent, AstAnnotation UniqueIdent) -> ModuleFromParser -> ModuleFromRenamingSource
applyRenaming
uses SYB to replace turn every Ident
in the Module
into to the
UIdent
version, i.e. set the UniqueIdent
.
At the same time, we also replace VarPat x with ConstrPat x if x an toplevel constant
It is an error if the Module
contains occurences of Ident
that are not covered by
the AstAnnotation
s.
data RenameError Source
type ModuleFromRenaming = Module FromRenamingSource
A module that has gone through renaming
data FromRenaming Source
Tag that a module has gone through renameing.