cryptol-2.2.6: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2015 Galois, Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Cryptol.ModuleSystem.Renamer

Description

Synopsis

- data NamingEnv
- shadowing :: NamingEnv -> NamingEnv -> NamingEnv
- class BindsNames a where
  - namingEnv :: a -> NamingEnv
- checkNamingEnv :: NamingEnv -> ([RenamerError], [RenamerWarning])
- class Rename a where
  - rename :: a -> RenameM a
- runRenamer :: NamingEnv -> RenameM a -> (Either [RenamerError] a, [RenamerWarning])
- data RenamerError
  - = MultipleSyms (Located QName) [NameOrigin]
  - | UnboundExpr (Located QName)
  - | UnboundType (Located QName)
  - | OverlappingSyms [NameOrigin]
  - | ExpectedValue (Located QName)
  - | ExpectedType (Located QName)
- data RenamerWarning = SymbolShadowed NameOrigin [NameOrigin]

# Documentation

data NamingEnv Source

Instances

Show NamingEnv Source |
Monoid NamingEnv Source |
BindsNames NamingEnv Source |

shadowing :: NamingEnv -> NamingEnv -> NamingEnv Source

Like mappend, but when merging, prefer values on the lhs.

class BindsNames a where Source

Things that define exported names.

Methods

namingEnv :: a -> NamingEnv Source

Instances

BindsNames TParam Source | Generate the naming environment for a type parameter.
BindsNames Schema Source | Generate a type renaming environment from the parameters that are bound by this schema.
BindsNames Pattern Source | Generate an expression renaming environment from a pattern. This ignores type parameters that can be bound by the pattern.
BindsNames Match Source | Translate names bound by the patterns of a match into a renaming environment.
BindsNames Bind Source |
BindsNames Decl Source | The naming environment for a single declaration, unqualified. This is meanat to be used for things like where clauses.
BindsNames Module Source | The naming environment for a single module. This is the mapping from unqualified internal names to fully qualified names.
BindsNames IfaceDecls Source | Translate a set of declarations from an interface into a naming environment.
BindsNames Iface Source | Produce a naming environment from an interface file, that contains a mapping only from unqualified names to qualified ones.
BindsNames NamingEnv Source |
BindsNames a => BindsNames [a] Source |
BindsNames a => BindsNames (Maybe a) Source |

checkNamingEnv :: NamingEnv -> ([RenamerError], [RenamerWarning]) Source

Throw errors for any names that overlap in a rewrite environment.

class Rename a where Source

Methods

rename :: a -> RenameM a Source

Instances

Rename Prop Source |
Rename Type Source |
Rename Schema Source | Rename a schema, assuming that none of its type variables are already in scope.
Rename Pattern Source |
Rename Match Source |
Rename TypeInst Source |
Rename Expr Source |
Rename Newtype Source |
Rename Pragma Source |
Rename Bind Source | Rename a binding. NOTE: this does not bind its own name into the naming context of its body. The assumption here is that this has been done by the enclosing environment, to allow for top-level renaming
Rename TySyn Source |
Rename Decl Source |
Rename TopDecl Source |
Rename Module Source |
Rename a => Rename [a] Source |
Rename a => Rename (Maybe a) Source |
Rename a => Rename (Located a) Source |
Rename a => Rename (Named a) Source |
Rename a => Rename (TopLevel a) Source |

runRenamer :: NamingEnv -> RenameM a -> (Either [RenamerError] a, [RenamerWarning]) Source

data RenamerError Source

Constructors

MultipleSyms (Located QName) [NameOrigin] | Multiple imported symbols contain this name
UnboundExpr (Located QName) | Expression name is not bound to any definition
UnboundType (Located QName) | Type name is not bound to any definition
OverlappingSyms [NameOrigin] | An environment has produced multiple overlapping symbols
ExpectedValue (Located QName) | When a value is expected from the naming environment, but one or more types exist instead.
ExpectedType (Located QName) | When a type is missing from the naming environment, but one or more values exist with the same name.

Instances

Show RenamerError Source |
PP RenamerError Source |

data RenamerWarning Source

Constructors

SymbolShadowed NameOrigin [NameOrigin] |

Instances

Show RenamerWarning Source |
PP RenamerWarning Source |