Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- data NamingEnv
- shadowing :: NamingEnv -> NamingEnv -> NamingEnv
- class BindsNames a where
- namingEnv :: a -> BuildNamingEnv
- data InModule a = InModule !ModName a
- namingEnv' :: BindsNames a => a -> Supply -> (NamingEnv, Supply)
- checkNamingEnv :: NamingEnv -> ([RenamerError], [RenamerWarning])
- shadowNames :: BindsNames env => env -> RenameM a -> RenameM a
- class Rename f where
- runRenamer :: Supply -> ModName -> NamingEnv -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning])
- data RenameM a
- data RenamerError
- = MultipleSyms (Located PName) [Name] NameDisp
- | UnboundExpr (Located PName) NameDisp
- | UnboundType (Located PName) NameDisp
- | OverlappingSyms [Name] NameDisp
- | ExpectedValue (Located PName) NameDisp
- | ExpectedType (Located PName) NameDisp
- | FixityError (Located Name) Fixity (Located Name) Fixity NameDisp
- | InvalidConstraint (Type PName) NameDisp
- | MalformedBuiltin (Type PName) PName NameDisp
- | BoundReservedType PName (Maybe Range) Doc NameDisp
- | OverlappingRecordUpdate (Located [Selector]) (Located [Selector]) NameDisp
- data RenamerWarning
- renameVar :: PName -> RenameM Name
- renameType :: PName -> RenameM Name
- renameModule :: Module PName -> RenameM (NamingEnv, Module Name)
Documentation
The NamingEnv
is used by the renamer to determine what
identifiers refer to.
Instances
Show NamingEnv Source # | |
Generic NamingEnv Source # | |
Semigroup NamingEnv Source # | |
Monoid NamingEnv Source # | |
NFData NamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv | |
BindsNames NamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv namingEnv :: NamingEnv -> BuildNamingEnv Source # | |
type Rep NamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv type Rep NamingEnv = D1 (MetaData "NamingEnv" "Cryptol.ModuleSystem.NamingEnv" "cryptol-2.9.0-4aSi1YZNBynFQwh9aOpllR" False) (C1 (MetaCons "NamingEnv" PrefixI True) (S1 (MetaSel (Just "neExprs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Map PName [Name])) :*: S1 (MetaSel (Just "neTypes") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Map PName [Name])))) |
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.
namingEnv :: a -> BuildNamingEnv Source #
Instances
Instances
namingEnv' :: BindsNames a => a -> Supply -> (NamingEnv, Supply) Source #
Generate a NamingEnv
using an explicit supply.
checkNamingEnv :: NamingEnv -> ([RenamerError], [RenamerWarning]) Source #
Throw errors for any names that overlap in a rewrite environment.
shadowNames :: BindsNames env => env -> RenameM a -> RenameM a Source #
Shadow the current naming environment with some more names.
Instances
Rename Prop Source # | |
Rename Type Source # | |
Rename TParam 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 UpdField Source # | Note that after this point the |
Rename Expr Source # | |
Rename PrimType Source # | |
Rename Newtype Source # | |
Rename BindDef Source # | |
Rename Bind Source # | Rename a binding. |
Rename PropSyn Source # | |
Rename TySyn Source # | |
Rename ParameterFun Source # | |
Defined in Cryptol.ModuleSystem.Renamer rename :: ParameterFun PName -> RenameM (ParameterFun Name) Source # | |
Rename ParameterType Source # | |
Defined in Cryptol.ModuleSystem.Renamer rename :: ParameterType PName -> RenameM (ParameterType Name) Source # | |
Rename Decl Source # | |
Rename TopDecl Source # | |
runRenamer :: Supply -> ModName -> NamingEnv -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning]) Source #
data RenamerError Source #
MultipleSyms (Located PName) [Name] NameDisp | Multiple imported symbols contain this name |
UnboundExpr (Located PName) NameDisp | Expression name is not bound to any definition |
UnboundType (Located PName) NameDisp | Type name is not bound to any definition |
OverlappingSyms [Name] NameDisp | An environment has produced multiple overlapping symbols |
ExpectedValue (Located PName) NameDisp | When a value is expected from the naming environment, but one or more types exist instead. |
ExpectedType (Located PName) NameDisp | When a type is missing from the naming environment, but one or more values exist with the same name. |
FixityError (Located Name) Fixity (Located Name) Fixity NameDisp | When the fixity of two operators conflict |
InvalidConstraint (Type PName) NameDisp | When it's not possible to produce a Prop from a Type. |
MalformedBuiltin (Type PName) PName NameDisp | When a builtin type/type-function is used incorrectly. |
BoundReservedType PName (Maybe Range) Doc NameDisp | When a builtin type is named in a binder. |
OverlappingRecordUpdate (Located [Selector]) (Located [Selector]) NameDisp | When record updates overlap (e.g., |
Instances
data RenamerWarning Source #