Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Cryptol.ModuleSystem.NamingEnv
Description
Synopsis
- module Cryptol.ModuleSystem.NamingEnv.Types
- without :: NamingEnv -> NamingEnv -> NamingEnv
- zipByTextName :: NamingEnv -> NamingEnv -> Map Name Name
- shadowing :: NamingEnv -> NamingEnv -> NamingEnv
- lookupNS :: Namespace -> PName -> NamingEnv -> Maybe Names
- travNamingEnv :: Applicative f => (Name -> f Name) -> NamingEnv -> f NamingEnv
- interpImportEnv :: ImportG name -> NamingEnv -> NamingEnv
- filterUNames :: (Name -> Bool) -> NamingEnv -> NamingEnv
- modParamNamingEnv :: ModParam -> NamingEnv
- mapNamingEnv :: (Name -> Name) -> NamingEnv -> NamingEnv
- namingEnvNames :: NamingEnv -> Set Name
- namingEnvFromNames :: Set Name -> NamingEnv
- namespaceMap :: Namespace -> NamingEnv -> Map PName Names
- lookupListNS :: Namespace -> PName -> NamingEnv -> [Name]
- singletonNS :: Namespace -> PName -> Name -> NamingEnv
- toPrimMap :: NamingEnv -> PrimMap
- toNameDisp :: NamingEnv -> NameDisp
- visibleNames :: NamingEnv -> Map Namespace (Set Name)
- qualify :: ModName -> NamingEnv -> NamingEnv
- filterPNames :: (PName -> Bool) -> NamingEnv -> NamingEnv
- findAmbig :: NamingEnv -> [[Name]]
- findShadowing :: NamingEnv -> NamingEnv -> [(PName, Name, [Name])]
- forceUnambig :: NamingEnv -> NamingEnv
- isEmptyNamingEnv :: NamingEnv -> Bool
- modParamNamesNamingEnv :: ModParamNames -> NamingEnv
- unqualifiedEnv :: IfaceDecls -> NamingEnv
Documentation
without :: NamingEnv -> NamingEnv -> NamingEnv Source #
Keep only the bindings in the 1st environment that are *NOT* in the second.
zipByTextName :: NamingEnv -> NamingEnv -> Map Name Name Source #
This "joins" two naming environments by matching the text name. The result maps the unique names from the first environment with the matching names in the second. This is used to compute the naming for an instantiated functor: * if the left environment has the defined names of the functor, and * the right one has the defined names of the instantiation, then * the result maps functor names to instance names.
shadowing :: NamingEnv -> NamingEnv -> NamingEnv Source #
Like mappend, but when merging, prefer values on the lhs.
lookupNS :: Namespace -> PName -> NamingEnv -> Maybe Names Source #
Resolve a name in the given namespace.
travNamingEnv :: Applicative f => (Name -> f Name) -> NamingEnv -> f NamingEnv Source #
Arguments
:: ImportG name | The import declarations |
-> NamingEnv | All public things coming in |
-> NamingEnv |
Adapt the things exported by something to the specific import/open.
modParamNamingEnv :: ModParam -> NamingEnv Source #
Compute a naming environment from a module parameter, qualifying it
according to mpQual
.
namespaceMap :: Namespace -> NamingEnv -> Map PName Names Source #
Get the names in a given namespace
lookupListNS :: Namespace -> PName -> NamingEnv -> [Name] Source #
Resolve a name in the given namespace.
singletonNS :: Namespace -> PName -> Name -> NamingEnv Source #
Singleton renaming environment for the given namespace.
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.
findAmbig :: NamingEnv -> [[Name]] Source #
Find the ambiguous entries in an environmet. A name is ambiguous if it might refer to multiple entities.
findShadowing :: NamingEnv -> NamingEnv -> [(PName, Name, [Name])] Source #
Get the subset of the first environment that shadows something in the second one.
forceUnambig :: NamingEnv -> NamingEnv Source #
Do an arbitrary choice for ambiguous names. We do this to continue checking afetr we've reported an ambiguity error.
isEmptyNamingEnv :: NamingEnv -> Bool Source #
modParamNamesNamingEnv :: ModParamNames -> NamingEnv Source #
Compute an unqualified naming environment, containing the various module parameters.
unqualifiedEnv :: IfaceDecls -> NamingEnv Source #
Generate a naming environment from a declaration interface, where none of the names are qualified.