Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Cryptol.ModuleSystem.Renamer
Description
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
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 Methods namingEnv :: NamingEnv -> BuildNamingEnv Source # | |
type Rep NamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv type Rep NamingEnv = D1 ('MetaData "NamingEnv" "Cryptol.ModuleSystem.NamingEnv" "cryptol-2.8.0-8MjdO3NUDs4I9u4d2J06AM" '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.
Methods
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 # | Resolve fixity, then rename the resulting type. |
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 Methods rename :: ParameterFun PName -> RenameM (ParameterFun Name) Source # | |
Rename ParameterType Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods 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 #
Constructors
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
Show RenamerError Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods showsPrec :: Int -> RenamerError -> ShowS show :: RenamerError -> String showList :: [RenamerError] -> ShowS | |
Generic RenamerError Source # | |
Defined in Cryptol.ModuleSystem.Renamer Associated Types type Rep RenamerError :: Type -> Type | |
NFData RenamerError Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods rnf :: RenamerError -> () | |
PP RenamerError Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods ppPrec :: Int -> RenamerError -> Doc Source # | |
type Rep RenamerError Source # | |
Defined in Cryptol.ModuleSystem.Renamer type Rep RenamerError = D1 ('MetaData "RenamerError" "Cryptol.ModuleSystem.Renamer" "cryptol-2.8.0-8MjdO3NUDs4I9u4d2J06AM" 'False) (((C1 ('MetaCons "MultipleSyms" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) :+: C1 ('MetaCons "UnboundExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) :+: (C1 ('MetaCons "UnboundType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp)) :+: (C1 ('MetaCons "OverlappingSyms" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp)) :+: C1 ('MetaCons "ExpectedValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))))) :+: ((C1 ('MetaCons "ExpectedType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp)) :+: (C1 ('MetaCons "FixityError" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located Name)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixity)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located Name)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixity) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp)))) :+: C1 ('MetaCons "InvalidConstraint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp)))) :+: (C1 ('MetaCons "MalformedBuiltin" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type PName)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) :+: (C1 ('MetaCons "BoundReservedType" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Range))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Doc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) :+: C1 ('MetaCons "OverlappingRecordUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located [Selector])) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located [Selector])) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))))))) |
data RenamerWarning Source #
Constructors
SymbolShadowed Name [Name] NameDisp | |
UnusedName Name NameDisp |
Instances
Show RenamerWarning Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods showsPrec :: Int -> RenamerWarning -> ShowS show :: RenamerWarning -> String showList :: [RenamerWarning] -> ShowS | |
Generic RenamerWarning Source # | |
Defined in Cryptol.ModuleSystem.Renamer Associated Types type Rep RenamerWarning :: Type -> Type | |
NFData RenamerWarning Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods rnf :: RenamerWarning -> () | |
PP RenamerWarning Source # | |
Defined in Cryptol.ModuleSystem.Renamer Methods ppPrec :: Int -> RenamerWarning -> Doc Source # | |
type Rep RenamerWarning Source # | |
Defined in Cryptol.ModuleSystem.Renamer type Rep RenamerWarning = D1 ('MetaData "RenamerWarning" "Cryptol.ModuleSystem.Renamer" "cryptol-2.8.0-8MjdO3NUDs4I9u4d2J06AM" 'False) (C1 ('MetaCons "SymbolShadowed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) :+: C1 ('MetaCons "UnusedName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDisp))) |