Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- newtype NamingEnv = NamingEnv (Map Namespace (Map PName [Name]))
- namingEnvNames :: NamingEnv -> Set Name
- namespaceMap :: Namespace -> NamingEnv -> Map PName [Name]
- lookupNS :: Namespace -> PName -> NamingEnv -> [Name]
- lookupValNames :: PName -> NamingEnv -> [Name]
- lookupTypeNames :: PName -> NamingEnv -> [Name]
- singletonNS :: Namespace -> PName -> Name -> NamingEnv
- singletonE :: PName -> Name -> NamingEnv
- singletonT :: PName -> Name -> NamingEnv
- namingEnvRename :: (Name -> Name) -> NamingEnv -> NamingEnv
- merge :: [Name] -> [Name] -> [Name]
- toPrimMap :: NamingEnv -> PrimMap
- toNameDisp :: NamingEnv -> NameDisp
- visibleNames :: NamingEnv -> Map Namespace (Set Name)
- qualify :: ModName -> NamingEnv -> NamingEnv
- filterNames :: (PName -> Bool) -> NamingEnv -> NamingEnv
- shadowing :: NamingEnv -> NamingEnv -> NamingEnv
- travNamingEnv :: Applicative f => (Name -> f Name) -> NamingEnv -> f NamingEnv
- data InModule a = InModule (Maybe ModPath) a
- newTop :: FreshM m => Namespace -> ModPath -> PName -> Maybe Fixity -> Range -> m Name
- newLocal :: FreshM m => Namespace -> PName -> Range -> m Name
- newtype BuildNamingEnv = BuildNamingEnv {}
- buildNamingEnv :: BuildNamingEnv -> Supply -> (NamingEnv, Supply)
- defsOf :: BindsNames a => a -> Supply -> (NamingEnv, Supply)
- type NestedMods = Map Name NamingEnv
- type CollectM = StateT NestedMods (SupplyT Id)
- collectNestedModules :: NamingEnv -> Module PName -> Supply -> (NestedMods, Supply)
- collectNestedModulesDecls :: NamingEnv -> ModName -> [TopDecl PName] -> Supply -> (NestedMods, Supply)
- collectNestedModulesDs :: ModPath -> NamingEnv -> [TopDecl PName] -> CollectM ()
- class BindsNames a where
- namingEnv :: a -> BuildNamingEnv
- interpImportEnv :: ImportG name -> NamingEnv -> NamingEnv
- interpImportIface :: Import -> IfaceDecls -> NamingEnv
- unqualifiedEnv :: IfaceDecls -> NamingEnv
- modParamsNamingEnv :: IfaceParams -> NamingEnv
- data ImportIface = ImportIface Import Iface
- moduleDefs :: ModPath -> ModuleG mname PName -> BuildNamingEnv
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 | |
PP NamingEnv Source # | |
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.13.0-BA7OuzmYZ3M9j8JsJfXs6b" 'True) (C1 ('MetaCons "NamingEnv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Namespace (Map PName [Name]))))) |
namespaceMap :: Namespace -> NamingEnv -> Map PName [Name] Source #
Get the names in a given namespace
lookupNS :: Namespace -> PName -> NamingEnv -> [Name] Source #
Resolve a name in the given namespace.
lookupValNames :: PName -> NamingEnv -> [Name] Source #
Return a list of value-level names to which this parsed name may refer.
lookupTypeNames :: PName -> NamingEnv -> [Name] Source #
Return a list of type-level names to which this parsed name may refer.
singletonNS :: Namespace -> PName -> Name -> NamingEnv Source #
Singleton renaming environment for the given namespace.
merge :: [Name] -> [Name] -> [Name] Source #
Merge two name maps, collapsing cases where the entries are the same, and producing conflicts otherwise.
toPrimMap :: NamingEnv -> PrimMap Source #
Generate a mapping from PrimIdent
to Name
for a
given naming environment.
toNameDisp :: NamingEnv -> NameDisp Source #
Generate a display format based on a naming environment.
visibleNames :: NamingEnv -> Map Namespace (Set Name) Source #
Produce sets of visible names for types and declarations.
NOTE: if entries in the NamingEnv would have produced a name clash, they will be omitted from the resulting sets.
qualify :: ModName -> NamingEnv -> NamingEnv Source #
Qualify all symbols in a NamingEnv
with the given prefix.
shadowing :: NamingEnv -> NamingEnv -> NamingEnv Source #
Like mappend, but when merging, prefer values on the lhs.
travNamingEnv :: Applicative f => (Name -> f Name) -> NamingEnv -> f NamingEnv Source #
Do somethign in context. If Nothing
than we are working with
a local declaration. Otherwise we are at the top-level of the
given module.
Instances
newtype BuildNamingEnv Source #
Instances
Semigroup BuildNamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv (<>) :: BuildNamingEnv -> BuildNamingEnv -> BuildNamingEnv # sconcat :: NonEmpty BuildNamingEnv -> BuildNamingEnv # stimes :: Integral b => b -> BuildNamingEnv -> BuildNamingEnv # | |
Monoid BuildNamingEnv Source # | |
Defined in Cryptol.ModuleSystem.NamingEnv mappend :: BuildNamingEnv -> BuildNamingEnv -> BuildNamingEnv # mconcat :: [BuildNamingEnv] -> BuildNamingEnv # |
buildNamingEnv :: BuildNamingEnv -> Supply -> (NamingEnv, Supply) Source #
defsOf :: BindsNames a => a -> Supply -> (NamingEnv, Supply) Source #
Generate a NamingEnv
using an explicit supply.
collectNestedModules :: NamingEnv -> Module PName -> Supply -> (NestedMods, Supply) Source #
collectNestedModulesDecls :: NamingEnv -> ModName -> [TopDecl PName] -> Supply -> (NestedMods, Supply) Source #
class BindsNames a where Source #
Things that define exported names.
namingEnv :: a -> BuildNamingEnv Source #
Instances
Adapt the things exported by something to the specific import/open.
:: Import | The import declarations |
-> IfaceDecls | Declarations of imported module |
-> NamingEnv |
Interpret an import in the context of an interface, to produce a name
environment for the renamer, and a NameDisp
for pretty-printing.
unqualifiedEnv :: IfaceDecls -> NamingEnv Source #
Generate a naming environment from a declaration interface, where none of the names are qualified.
modParamsNamingEnv :: IfaceParams -> NamingEnv Source #
Compute an unqualified naming environment, containing the various module parameters.
data ImportIface Source #
Instances
BindsNames ImportIface Source # | Produce a naming environment from an interface file, that contains a mapping only from unqualified names to qualified ones. |
Defined in Cryptol.ModuleSystem.NamingEnv |
moduleDefs :: ModPath -> ModuleG mname PName -> BuildNamingEnv Source #