Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines the notion of a scope and operations on scopes.
Synopsis
- data Scope = Scope {}
- data DataOrRecordModule
- data NameSpaceId
- allNameSpaces :: [NameSpaceId]
- type ScopeNameSpaces = [(NameSpaceId, NameSpace)]
- localNameSpace :: Access -> NameSpaceId
- nameSpaceAccess :: NameSpaceId -> Access
- scopeNameSpace :: NameSpaceId -> Scope -> NameSpace
- updateScopeNameSpaces :: (ScopeNameSpaces -> ScopeNameSpaces) -> Scope -> Scope
- updateScopeNameSpacesM :: Functor m => (ScopeNameSpaces -> m ScopeNameSpaces) -> Scope -> m Scope
- data ScopeInfo = ScopeInfo {}
- data NameMapEntry = NameMapEntry {}
- type NameMap = Map QName NameMapEntry
- type ModuleMap = Map ModuleName [QName]
- type LocalVars = AssocList Name LocalVar
- data BindingSource
- data LocalVar = LocalVar {}
- shadowLocal :: List1 AbstractName -> LocalVar -> LocalVar
- patternToModuleBound :: LocalVar -> LocalVar
- notShadowedLocal :: LocalVar -> Maybe Name
- notShadowedLocals :: LocalVars -> AssocList Name Name
- scopeCurrent :: Lens' ScopeInfo ModuleName
- scopeModules :: Lens' ScopeInfo (Map ModuleName Scope)
- scopeVarsToBind :: Lens' ScopeInfo LocalVars
- scopeLocals :: Lens' ScopeInfo LocalVars
- scopePrecedence :: Lens' ScopeInfo PrecedenceStack
- scopeInverseName :: Lens' ScopeInfo NameMap
- scopeInverseModule :: Lens' ScopeInfo ModuleMap
- scopeInScope :: Lens' ScopeInfo InScopeSet
- scopeFixities :: Lens' ScopeInfo Fixities
- scopePolarities :: Lens' ScopeInfo Polarities
- scopeFixitiesAndPolarities :: Lens' ScopeInfo (Fixities, Polarities)
- updateVarsToBind :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo
- setVarsToBind :: LocalVars -> ScopeInfo -> ScopeInfo
- updateScopeLocals :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo
- setScopeLocals :: LocalVars -> ScopeInfo -> ScopeInfo
- data NameSpace = NameSpace {}
- type ThingsInScope a = Map Name (List1 a)
- type NamesInScope = ThingsInScope AbstractName
- type ModulesInScope = ThingsInScope AbstractModule
- type InScopeSet = Set QName
- data InScopeTag a where
- class Ord a => InScope a where
- inScopeTag :: InScopeTag a
- inNameSpace :: InScope a => NameSpace -> ThingsInScope a
- data NameOrModule
- data KindOfName
- isDefName :: KindOfName -> Bool
- isConName :: KindOfName -> Maybe Induction
- conKindOfName :: Induction -> KindOfName
- conKindOfName' :: Foldable t => t Induction -> KindOfName
- approxConInduction :: Foldable t => t Induction -> Induction
- exactConInduction :: Foldable t => t Induction -> Maybe Induction
- exactConName :: Foldable t => t Induction -> Maybe KindOfName
- data KindsOfNames
- = AllKindsOfNames
- | SomeKindsOfNames (Set KindOfName)
- | ExceptKindsOfNames (Set KindOfName)
- elemKindsOfNames :: KindOfName -> KindsOfNames -> Bool
- allKindsOfNames :: KindsOfNames
- someKindsOfNames :: [KindOfName] -> KindsOfNames
- exceptKindsOfNames :: [KindOfName] -> KindsOfNames
- data WithKind a = WithKind {
- theKind :: KindOfName
- kindedThing :: a
- data WhyInScope
- data AbstractName = AbsName {}
- data NameMetadata
- = NoMetadata
- | GeneralizedVarsMetadata (Map QName Name)
- data AbstractModule = AbsModule {}
- lensAnameName :: Lens' AbstractName QName
- lensAmodName :: Lens' AbstractModule ModuleName
- data ResolvedName
- data AmbiguousNameReason
- ambiguousNamesInReason :: AmbiguousNameReason -> List2 QName
- data WhyInScopeData = WhyInScopeData QName FilePath (Maybe LocalVar) [AbstractName] [AbstractModule]
- whyInScopeDataFromAmbiguousNameReason :: QName -> AmbiguousNameReason -> WhyInScopeData
- mergeNames :: Eq a => ThingsInScope a -> ThingsInScope a -> ThingsInScope a
- mergeNamesMany :: Eq a => [ThingsInScope a] -> ThingsInScope a
- emptyNameSpace :: NameSpace
- mapNameSpace :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> NameSpace -> NameSpace
- zipNameSpace :: (NamesInScope -> NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> NameSpace -> NameSpace -> NameSpace
- mapNameSpaceM :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> NameSpace -> m NameSpace
- emptyScope :: Scope
- emptyScopeInfo :: ScopeInfo
- mapScope :: (NameSpaceId -> NamesInScope -> NamesInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet) -> Scope -> Scope
- mapScope_ :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope
- mapScopeNS :: NameSpaceId -> (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope
- mapScopeM :: Applicative m => (NameSpaceId -> NamesInScope -> m NamesInScope) -> (NameSpaceId -> ModulesInScope -> m ModulesInScope) -> (NameSpaceId -> InScopeSet -> m InScopeSet) -> Scope -> m Scope
- mapScopeM_ :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> Scope -> m Scope
- zipScope :: (NameSpaceId -> NamesInScope -> NamesInScope -> NamesInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope
- zipScope_ :: (NamesInScope -> NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope
- recomputeInScopeSets :: Scope -> Scope
- filterScope :: (Name -> Bool) -> (Name -> Bool) -> Scope -> Scope
- allNamesInScope :: InScope a => Scope -> ThingsInScope a
- allNamesInScope' :: InScope a => Scope -> ThingsInScope (a, Access)
- findNameInScope :: InScope a => Name -> Scope -> [(a, Access)]
- exportedNamesInScope :: InScope a => Scope -> ThingsInScope a
- namesInScope :: InScope a => [NameSpaceId] -> Scope -> ThingsInScope a
- allThingsInScope :: Scope -> NameSpace
- thingsInScope :: [NameSpaceId] -> Scope -> NameSpace
- mergeScope :: Scope -> Scope -> Scope
- mergeScopes :: [Scope] -> Scope
- setScopeAccess :: NameSpaceId -> Scope -> Scope
- setNameSpace :: NameSpaceId -> NameSpace -> Scope -> Scope
- modifyNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> Scope -> Scope
- addNameToScope :: NameSpaceId -> Name -> AbstractName -> Scope -> Scope
- removeNameFromScope :: NameSpaceId -> Name -> Scope -> Scope
- addModuleToScope :: NameSpaceId -> Name -> AbstractModule -> Scope -> Scope
- data UsingOrHiding
- usingOrHiding :: ImportDirective -> UsingOrHiding
- applyImportDirective :: ImportDirective -> Scope -> Scope
- applyImportDirective_ :: ImportDirective -> Scope -> (Scope, (Set Name, Set Name))
- renameCanonicalNames :: Map QName QName -> Map ModuleName ModuleName -> Scope -> Scope
- restrictPrivate :: Scope -> Scope
- restrictLocalPrivate :: ModuleName -> Scope -> Scope
- withoutPrivates :: ScopeInfo -> ScopeInfo
- disallowGeneralizedVars :: Scope -> Scope
- inScopeBecause :: (WhyInScope -> WhyInScope) -> Scope -> Scope
- publicModules :: ScopeInfo -> Map ModuleName Scope
- publicNames :: ScopeInfo -> Set AbstractName
- publicNamesOfModules :: Map ModuleName Scope -> [AbstractName]
- everythingInScope :: ScopeInfo -> NameSpace
- everythingInScopeQualified :: ScopeInfo -> NameSpace
- concreteNamesInScope :: ScopeInfo -> Set QName
- scopeLookup :: InScope a => QName -> ScopeInfo -> [a]
- scopeLookup' :: InScope a => QName -> ScopeInfo -> [(a, Access)]
- data AllowAmbiguousNames
- isNameInScope :: QName -> ScopeInfo -> Bool
- isNameInScopeUnqualified :: QName -> ScopeInfo -> Bool
- inverseScopeLookupName :: QName -> ScopeInfo -> [QName]
- inverseScopeLookupName' :: AllowAmbiguousNames -> QName -> ScopeInfo -> [QName]
- inverseScopeLookupName'' :: AllowAmbiguousNames -> QName -> ScopeInfo -> Maybe NameMapEntry
- inverseScopeLookupModule :: ModuleName -> ScopeInfo -> [QName]
- inverseScopeLookupModule' :: AllowAmbiguousNames -> ModuleName -> ScopeInfo -> [QName]
- recomputeInverseScopeMaps :: ScopeInfo -> ScopeInfo
- class SetBindingSite a where
- setBindingSite :: Range -> a -> a
- prettyNameSpace :: NameSpace -> [Doc]
- blockOfLines :: Doc -> [Doc] -> [Doc]
Scope representation
A scope is a named collection of names partitioned into public and private names.
Instances
Pretty Scope Source # | |||||
InstantiateFull Scope Source # | |||||
Defined in Agda.TypeChecking.Reduce | |||||
EmbPrj Scope Source # | |||||
Null Scope Source # | |||||
NFData Scope Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Generic Scope Source # | |||||
Defined in Agda.Syntax.Scope.Base
| |||||
Show Scope Source # | |||||
Eq Scope Source # | |||||
type Rep Scope Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep Scope = D1 ('MetaData "Scope" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "Scope" 'PrefixI 'True) ((S1 ('MetaSel ('Just "scopeName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName) :*: S1 ('MetaSel ('Just "scopeParents") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ModuleName])) :*: (S1 ('MetaSel ('Just "scopeNameSpaces") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScopeNameSpaces) :*: (S1 ('MetaSel ('Just "scopeImports") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map QName ModuleName)) :*: S1 ('MetaSel ('Just "scopeDatatypeModule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DataOrRecordModule)))))) |
data DataOrRecordModule Source #
Instances
data NameSpaceId Source #
See Access
.
PrivateNS | Things not exported by this module. |
PublicNS | Things defined and exported by this module. |
ImportedNS | Things from open public, exported by this module. |
Instances
Pretty NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base pretty :: NameSpaceId -> Doc Source # prettyPrec :: Int -> NameSpaceId -> Doc Source # prettyList :: [NameSpaceId] -> Doc Source # | |||||
EmbPrj NameSpaceId Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: NameSpaceId -> S Int32 Source # icod_ :: NameSpaceId -> S Int32 Source # value :: Int32 -> R NameSpaceId Source # | |||||
NFData NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: NameSpaceId -> () | |||||
Bounded NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Enum NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base succ :: NameSpaceId -> NameSpaceId pred :: NameSpaceId -> NameSpaceId toEnum :: Int -> NameSpaceId fromEnum :: NameSpaceId -> Int enumFrom :: NameSpaceId -> [NameSpaceId] enumFromThen :: NameSpaceId -> NameSpaceId -> [NameSpaceId] enumFromTo :: NameSpaceId -> NameSpaceId -> [NameSpaceId] enumFromThenTo :: NameSpaceId -> NameSpaceId -> NameSpaceId -> [NameSpaceId] | |||||
Generic NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: NameSpaceId -> Rep NameSpaceId x to :: Rep NameSpaceId x -> NameSpaceId | |||||
Show NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> NameSpaceId -> ShowS show :: NameSpaceId -> String showList :: [NameSpaceId] -> ShowS | |||||
Eq NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: NameSpaceId -> NameSpaceId -> Bool (/=) :: NameSpaceId -> NameSpaceId -> Bool | |||||
type Rep NameSpaceId Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep NameSpaceId = D1 ('MetaData "NameSpaceId" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "PrivateNS" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PublicNS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ImportedNS" 'PrefixI 'False) (U1 :: Type -> Type))) |
allNameSpaces :: [NameSpaceId] Source #
type ScopeNameSpaces = [(NameSpaceId, NameSpace)] Source #
localNameSpace :: Access -> NameSpaceId Source #
nameSpaceAccess :: NameSpaceId -> Access Source #
scopeNameSpace :: NameSpaceId -> Scope -> NameSpace Source #
updateScopeNameSpaces :: (ScopeNameSpaces -> ScopeNameSpaces) -> Scope -> Scope Source #
A lens for scopeNameSpaces
updateScopeNameSpacesM :: Functor m => (ScopeNameSpaces -> m ScopeNameSpaces) -> Scope -> m Scope Source #
`Monadic'
lens (Functor sufficient).
The complete information about the scope at a particular program point includes the scope stack, the local variables, and the context precedence.
ScopeInfo | |
|
Instances
Pretty ScopeInfo Source # | |||||
KillRange ScopeInfo Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
EmbPrj ScopeInfo Source # | |||||
Null ScopeInfo Source # | |||||
NFData ScopeInfo Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Generic ScopeInfo Source # | |||||
Defined in Agda.Syntax.Scope.Base
| |||||
Show ScopeInfo Source # | |||||
Eq ScopeInfo Source # | |||||
type Rep ScopeInfo Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep ScopeInfo = D1 ('MetaData "ScopeInfo" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "ScopeInfo" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_scopeCurrent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName) :*: S1 ('MetaSel ('Just "_scopeModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map ModuleName Scope))) :*: (S1 ('MetaSel ('Just "_scopeVarsToBind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalVars) :*: (S1 ('MetaSel ('Just "_scopeLocals") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalVars) :*: S1 ('MetaSel ('Just "_scopePrecedence") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PrecedenceStack)))) :*: ((S1 ('MetaSel ('Just "_scopeInverseName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameMap) :*: S1 ('MetaSel ('Just "_scopeInverseModule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleMap)) :*: (S1 ('MetaSel ('Just "_scopeInScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InScopeSet) :*: (S1 ('MetaSel ('Just "_scopeFixities") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixities) :*: S1 ('MetaSel ('Just "_scopePolarities") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Polarities)))))) |
data NameMapEntry Source #
For the sake of highlighting, the _scopeInverseName
map also stores
the KindOfName
of an A.QName
.
NameMapEntry | |
|
Instances
NFData NameMapEntry Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: NameMapEntry -> () | |||||
Semigroup NameMapEntry Source # | Invariant: the | ||||
Defined in Agda.Syntax.Scope.Base (<>) :: NameMapEntry -> NameMapEntry -> NameMapEntry # sconcat :: NonEmpty NameMapEntry -> NameMapEntry stimes :: Integral b => b -> NameMapEntry -> NameMapEntry | |||||
Generic NameMapEntry Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: NameMapEntry -> Rep NameMapEntry x to :: Rep NameMapEntry x -> NameMapEntry | |||||
Show NameMapEntry Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> NameMapEntry -> ShowS show :: NameMapEntry -> String showList :: [NameMapEntry] -> ShowS | |||||
type Rep NameMapEntry Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep NameMapEntry = D1 ('MetaData "NameMapEntry" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "NameMapEntry" 'PrefixI 'True) (S1 ('MetaSel ('Just "qnameKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 KindOfName) :*: S1 ('MetaSel ('Just "qnameConcrete") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List1 QName)))) |
type NameMap = Map QName NameMapEntry Source #
type ModuleMap = Map ModuleName [QName] Source #
data BindingSource Source #
For each bound variable, we want to know whether it was bound by a
λ, Π, module telescope, pattern, or let
.
LambdaBound |
|
PatternBound Hiding |
|
LetBound | let ... in |
WithBound | | ... in q |
Instances
Pretty BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base pretty :: BindingSource -> Doc Source # prettyPrec :: Int -> BindingSource -> Doc Source # prettyList :: [BindingSource] -> Doc Source # | |||||
EmbPrj BindingSource Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: BindingSource -> S Int32 Source # icod_ :: BindingSource -> S Int32 Source # value :: Int32 -> R BindingSource Source # | |||||
NFData BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: BindingSource -> () | |||||
Generic BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: BindingSource -> Rep BindingSource x to :: Rep BindingSource x -> BindingSource | |||||
Show BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> BindingSource -> ShowS show :: BindingSource -> String showList :: [BindingSource] -> ShowS | |||||
Eq BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: BindingSource -> BindingSource -> Bool (/=) :: BindingSource -> BindingSource -> Bool | |||||
type Rep BindingSource Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep BindingSource = D1 ('MetaData "BindingSource" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) ((C1 ('MetaCons "LambdaBound" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PatternBound" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Hiding))) :+: (C1 ('MetaCons "LetBound" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WithBound" 'PrefixI 'False) (U1 :: Type -> Type))) |
A local variable can be shadowed by an import. In case of reference to a shadowed variable, we want to report a scope error.
LocalVar | |
|
Instances
Pretty LocalVar Source # | We show shadowed variables as prefixed by a ".", as not in scope. | ||||
EmbPrj LocalVar Source # | |||||
NFData LocalVar Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Generic LocalVar Source # | |||||
Defined in Agda.Syntax.Scope.Base
| |||||
Show LocalVar Source # | |||||
Eq LocalVar Source # | |||||
Ord LocalVar Source # | |||||
type Rep LocalVar Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep LocalVar = D1 ('MetaData "LocalVar" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "LocalVar" 'PrefixI 'True) (S1 ('MetaSel ('Just "localVar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: (S1 ('MetaSel ('Just "localBindingSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BindingSource) :*: S1 ('MetaSel ('Just "localShadowedBy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [AbstractName])))) |
shadowLocal :: List1 AbstractName -> LocalVar -> LocalVar Source #
Shadow a local name by a non-empty list of imports.
patternToModuleBound :: LocalVar -> LocalVar Source #
Treat patternBound variable as a module parameter
notShadowedLocals :: LocalVars -> AssocList Name Name Source #
Get all locals that are not shadowed by imports.
scopeCurrent :: Lens' ScopeInfo ModuleName Source #
Lenses for ScopeInfo components
scopeModules :: Lens' ScopeInfo (Map ModuleName Scope) Source #
updateVarsToBind :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo Source #
Lens for scopeVarsToBind
.
updateScopeLocals :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo Source #
Lens for scopeLocals
.
Name spaces
A NameSpace
contains the mappings from concrete names that the user can
write to the abstract fully qualified names that the type checker wants to
read.
NameSpace | |
|
Instances
Pretty NameSpace Source # | |||||
EmbPrj NameSpace Source # | |||||
NFData NameSpace Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Generic NameSpace Source # | |||||
Defined in Agda.Syntax.Scope.Base
| |||||
Show NameSpace Source # | |||||
Eq NameSpace Source # | |||||
type Rep NameSpace Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep NameSpace = D1 ('MetaData "NameSpace" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "NameSpace" 'PrefixI 'True) (S1 ('MetaSel ('Just "nsNames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NamesInScope) :*: (S1 ('MetaSel ('Just "nsModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModulesInScope) :*: S1 ('MetaSel ('Just "nsInScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InScopeSet)))) |
type ThingsInScope a = Map Name (List1 a) Source #
type NamesInScope = ThingsInScope AbstractName Source #
type InScopeSet = Set QName Source #
data InScopeTag a where Source #
Set of types consisting of exactly AbstractName
and AbstractModule
.
A GADT just for some dependent-types trickery.
class Ord a => InScope a where Source #
Type class for some dependent-types trickery.
inScopeTag :: InScopeTag a Source #
Instances
InScope AbstractModule Source # | |
Defined in Agda.Syntax.Scope.Base | |
InScope AbstractName Source # | |
Defined in Agda.Syntax.Scope.Base |
inNameSpace :: InScope a => NameSpace -> ThingsInScope a Source #
inNameSpace
selects either the name map or the module name map from
a NameSpace
. What is selected is determined by result type
(using the dependent-type trickery).
data NameOrModule Source #
Non-dependent tag for name or module.
Instances
EmbPrj NameOrModule Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: NameOrModule -> S Int32 Source # icod_ :: NameOrModule -> S Int32 Source # value :: Int32 -> R NameOrModule Source # | |||||
NFData NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: NameOrModule -> () | |||||
Bounded NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Enum NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base succ :: NameOrModule -> NameOrModule pred :: NameOrModule -> NameOrModule toEnum :: Int -> NameOrModule fromEnum :: NameOrModule -> Int enumFrom :: NameOrModule -> [NameOrModule] enumFromThen :: NameOrModule -> NameOrModule -> [NameOrModule] enumFromTo :: NameOrModule -> NameOrModule -> [NameOrModule] enumFromThenTo :: NameOrModule -> NameOrModule -> NameOrModule -> [NameOrModule] | |||||
Generic NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: NameOrModule -> Rep NameOrModule x to :: Rep NameOrModule x -> NameOrModule | |||||
Show NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> NameOrModule -> ShowS show :: NameOrModule -> String showList :: [NameOrModule] -> ShowS | |||||
Eq NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: NameOrModule -> NameOrModule -> Bool (/=) :: NameOrModule -> NameOrModule -> Bool | |||||
Ord NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base compare :: NameOrModule -> NameOrModule -> Ordering (<) :: NameOrModule -> NameOrModule -> Bool (<=) :: NameOrModule -> NameOrModule -> Bool (>) :: NameOrModule -> NameOrModule -> Bool (>=) :: NameOrModule -> NameOrModule -> Bool max :: NameOrModule -> NameOrModule -> NameOrModule min :: NameOrModule -> NameOrModule -> NameOrModule | |||||
type Rep NameOrModule Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep NameOrModule = D1 ('MetaData "NameOrModule" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "NameNotModule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ModuleNotName" 'PrefixI 'False) (U1 :: Type -> Type)) |
Decorated names
data KindOfName Source #
For the sake of parsing left-hand sides, we distinguish constructor and record field names from defined names.
ConName | Constructor name ( |
CoConName | Constructor name (definitely |
FldName | Record field name. |
PatternSynName | Name of a pattern synonym. |
GeneralizeName | Name to be generalized |
DisallowedGeneralizeName | Generalizable variable from a let open |
MacroName | Name of a macro |
QuotableName | A name that can only be quoted.
Previous category |
DataName | Name of a |
RecName | Name of a |
FunName | Name of a defined function. |
AxiomName | Name of a |
PrimName | Name of a |
OtherDefName | A |
Instances
EmbPrj KindOfName Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: KindOfName -> S Int32 Source # icod_ :: KindOfName -> S Int32 Source # value :: Int32 -> R KindOfName Source # | |||||
NFData KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: KindOfName -> () | |||||
Bounded KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Enum KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base succ :: KindOfName -> KindOfName pred :: KindOfName -> KindOfName toEnum :: Int -> KindOfName fromEnum :: KindOfName -> Int enumFrom :: KindOfName -> [KindOfName] enumFromThen :: KindOfName -> KindOfName -> [KindOfName] enumFromTo :: KindOfName -> KindOfName -> [KindOfName] enumFromThenTo :: KindOfName -> KindOfName -> KindOfName -> [KindOfName] | |||||
Generic KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: KindOfName -> Rep KindOfName x to :: Rep KindOfName x -> KindOfName | |||||
Show KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> KindOfName -> ShowS show :: KindOfName -> String showList :: [KindOfName] -> ShowS | |||||
Eq KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: KindOfName -> KindOfName -> Bool (/=) :: KindOfName -> KindOfName -> Bool | |||||
Ord KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base compare :: KindOfName -> KindOfName -> Ordering (<) :: KindOfName -> KindOfName -> Bool (<=) :: KindOfName -> KindOfName -> Bool (>) :: KindOfName -> KindOfName -> Bool (>=) :: KindOfName -> KindOfName -> Bool max :: KindOfName -> KindOfName -> KindOfName min :: KindOfName -> KindOfName -> KindOfName | |||||
type Rep KindOfName Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep KindOfName = D1 ('MetaData "KindOfName" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (((C1 ('MetaCons "ConName" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CoConName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FldName" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "PatternSynName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GeneralizeName" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DisallowedGeneralizeName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MacroName" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "QuotableName" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DataName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RecName" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "FunName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AxiomName" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PrimName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherDefName" 'PrefixI 'False) (U1 :: Type -> Type))))) |
isDefName :: KindOfName -> Bool Source #
conKindOfName :: Induction -> KindOfName Source #
conKindOfName' :: Foldable t => t Induction -> KindOfName Source #
approxConInduction :: Foldable t => t Induction -> Induction Source #
exactConName :: Foldable t => t Induction -> Maybe KindOfName Source #
Only return [Co]ConName
if no ambiguity.
data KindsOfNames Source #
A set of KindOfName
, for the sake of elemKindsOfNames
.
AllKindsOfNames | |
SomeKindsOfNames (Set KindOfName) | Only these kinds. |
ExceptKindsOfNames (Set KindOfName) | All but these Kinds. |
elemKindsOfNames :: KindOfName -> KindsOfNames -> Bool Source #
someKindsOfNames :: [KindOfName] -> KindsOfNames Source #
exceptKindsOfNames :: [KindOfName] -> KindsOfNames Source #
Decorate something with KindOfName
WithKind | |
|
Instances
DeclaredNames KName Source # | |
Defined in Agda.Syntax.Abstract.Views declaredNames :: Collection KName m => KName -> m Source # | |
Functor WithKind Source # | |
Foldable WithKind Source # | |
Defined in Agda.Syntax.Scope.Base fold :: Monoid m => WithKind m -> m foldMap :: Monoid m => (a -> m) -> WithKind a -> m foldMap' :: Monoid m => (a -> m) -> WithKind a -> m foldr :: (a -> b -> b) -> b -> WithKind a -> b foldr' :: (a -> b -> b) -> b -> WithKind a -> b foldl :: (b -> a -> b) -> b -> WithKind a -> b foldl' :: (b -> a -> b) -> b -> WithKind a -> b foldr1 :: (a -> a -> a) -> WithKind a -> a foldl1 :: (a -> a -> a) -> WithKind a -> a elem :: Eq a => a -> WithKind a -> Bool maximum :: Ord a => WithKind a -> a minimum :: Ord a => WithKind a -> a | |
Traversable WithKind Source # | |
Show a => Show (WithKind a) Source # | |
Eq a => Eq (WithKind a) Source # | |
Ord a => Ord (WithKind a) Source # | |
Defined in Agda.Syntax.Scope.Base |
data WhyInScope Source #
Where does a name come from?
This information is solely for reporting to the user,
see whyInScope
.
Defined | Defined in this module. |
Opened QName WhyInScope | Imported from another module. |
Applied QName WhyInScope | Imported by a module application. |
Instances
EmbPrj WhyInScope Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: WhyInScope -> S Int32 Source # icod_ :: WhyInScope -> S Int32 Source # value :: Int32 -> R WhyInScope Source # | |||||
NFData WhyInScope Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: WhyInScope -> () | |||||
Generic WhyInScope Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: WhyInScope -> Rep WhyInScope x to :: Rep WhyInScope x -> WhyInScope | |||||
Show WhyInScope Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> WhyInScope -> ShowS show :: WhyInScope -> String showList :: [WhyInScope] -> ShowS | |||||
type Rep WhyInScope Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep WhyInScope = D1 ('MetaData "WhyInScope" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "Defined" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Opened" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WhyInScope)) :+: C1 ('MetaCons "Applied" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WhyInScope)))) |
data AbstractName Source #
A decoration of QName
.
AbsName | |
|
Instances
NameToExpr AbstractName Source # | Turn an | ||||
Defined in Agda.Syntax.Abstract nameToExpr :: AbstractName -> Expr Source # | |||||
LensFixity AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
Pretty AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base pretty :: AbstractName -> Doc Source # prettyPrec :: Int -> AbstractName -> Doc Source # prettyList :: [AbstractName] -> Doc Source # | |||||
HasRange AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base getRange :: AbstractName -> Range Source # | |||||
SetRange AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base setRange :: Range -> AbstractName -> AbstractName Source # | |||||
InScope AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
SetBindingSite AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> AbstractName -> AbstractName Source # | |||||
ToConcrete AbstractName Source # | |||||
Defined in Agda.Syntax.Translation.AbstractToConcrete
toConcrete :: AbstractName -> AbsToCon (ConOfAbs AbstractName) Source # bindToConcrete :: AbstractName -> (ConOfAbs AbstractName -> AbsToCon b) -> AbsToCon b Source # | |||||
PrettyTCM AbstractName Source # | |||||
Defined in Agda.TypeChecking.Pretty prettyTCM :: MonadPretty m => AbstractName -> m Doc Source # | |||||
EmbPrj AbstractName Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: AbstractName -> S Int32 Source # icod_ :: AbstractName -> S Int32 Source # value :: Int32 -> R AbstractName Source # | |||||
NFData AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: AbstractName -> () | |||||
Generic AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: AbstractName -> Rep AbstractName x to :: Rep AbstractName x -> AbstractName | |||||
Show AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> AbstractName -> ShowS show :: AbstractName -> String showList :: [AbstractName] -> ShowS | |||||
Eq AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: AbstractName -> AbstractName -> Bool (/=) :: AbstractName -> AbstractName -> Bool | |||||
Ord AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base compare :: AbstractName -> AbstractName -> Ordering (<) :: AbstractName -> AbstractName -> Bool (<=) :: AbstractName -> AbstractName -> Bool (>) :: AbstractName -> AbstractName -> Bool (>=) :: AbstractName -> AbstractName -> Bool max :: AbstractName -> AbstractName -> AbstractName min :: AbstractName -> AbstractName -> AbstractName | |||||
type ConOfAbs AbstractName Source # | |||||
Defined in Agda.Syntax.Translation.AbstractToConcrete | |||||
type Rep AbstractName Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep AbstractName = D1 ('MetaData "AbstractName" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "AbsName" 'PrefixI 'True) ((S1 ('MetaSel ('Just "anameName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName) :*: S1 ('MetaSel ('Just "anameKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 KindOfName)) :*: (S1 ('MetaSel ('Just "anameLineage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WhyInScope) :*: S1 ('MetaSel ('Just "anameMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameMetadata)))) |
data NameMetadata Source #
Instances
EmbPrj NameMetadata Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: NameMetadata -> S Int32 Source # icod_ :: NameMetadata -> S Int32 Source # value :: Int32 -> R NameMetadata Source # | |||||
NFData NameMetadata Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: NameMetadata -> () | |||||
Generic NameMetadata Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: NameMetadata -> Rep NameMetadata x to :: Rep NameMetadata x -> NameMetadata | |||||
Show NameMetadata Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> NameMetadata -> ShowS show :: NameMetadata -> String showList :: [NameMetadata] -> ShowS | |||||
type Rep NameMetadata Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep NameMetadata = D1 ('MetaData "NameMetadata" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "NoMetadata" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GeneralizedVarsMetadata" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map QName Name)))) |
data AbstractModule Source #
A decoration of abstract syntax module names.
AbsModule | |
|
Instances
Pretty AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base pretty :: AbstractModule -> Doc Source # prettyPrec :: Int -> AbstractModule -> Doc Source # prettyList :: [AbstractModule] -> Doc Source # | |||||
InScope AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base | |||||
SetBindingSite AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> AbstractModule -> AbstractModule Source # | |||||
EmbPrj AbstractModule Source # | |||||
Defined in Agda.TypeChecking.Serialise.Instances.Abstract icode :: AbstractModule -> S Int32 Source # icod_ :: AbstractModule -> S Int32 Source # value :: Int32 -> R AbstractModule Source # | |||||
NFData AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: AbstractModule -> () | |||||
Generic AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: AbstractModule -> Rep AbstractModule x to :: Rep AbstractModule x -> AbstractModule | |||||
Show AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> AbstractModule -> ShowS show :: AbstractModule -> String showList :: [AbstractModule] -> ShowS | |||||
Eq AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: AbstractModule -> AbstractModule -> Bool (/=) :: AbstractModule -> AbstractModule -> Bool | |||||
Ord AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base compare :: AbstractModule -> AbstractModule -> Ordering (<) :: AbstractModule -> AbstractModule -> Bool (<=) :: AbstractModule -> AbstractModule -> Bool (>) :: AbstractModule -> AbstractModule -> Bool (>=) :: AbstractModule -> AbstractModule -> Bool max :: AbstractModule -> AbstractModule -> AbstractModule min :: AbstractModule -> AbstractModule -> AbstractModule | |||||
type Rep AbstractModule Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep AbstractModule = D1 ('MetaData "AbstractModule" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "AbsModule" 'PrefixI 'True) (S1 ('MetaSel ('Just "amodName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName) :*: S1 ('MetaSel ('Just "amodLineage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WhyInScope))) |
lensAnameName :: Lens' AbstractName QName Source #
Van Laarhoven lens on anameName
.
lensAmodName :: Lens' AbstractModule ModuleName Source #
Van Laarhoven lens on amodName
.
data ResolvedName Source #
VarName | Local variable bound by λ, Π, module telescope, pattern, |
| |
DefinedName | Function, data/record type, postulate. |
| |
FieldName | Record field name. Needs to be distinguished to parse copatterns. |
ConstructorName | Data or record constructor name. |
| |
PatternSynResName | Name of pattern synonym. |
| |
UnknownName | Unbound name. |
Instances
NameToExpr ResolvedName Source # | Turn a Assumes name is not | ||||
Defined in Agda.Syntax.Abstract nameToExpr :: ResolvedName -> Expr Source # | |||||
Pretty ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base pretty :: ResolvedName -> Doc Source # prettyPrec :: Int -> ResolvedName -> Doc Source # prettyList :: [ResolvedName] -> Doc Source # | |||||
ToConcrete ResolvedName Source # | Assumes name is not | ||||
Defined in Agda.Syntax.Translation.AbstractToConcrete
toConcrete :: ResolvedName -> AbsToCon (ConOfAbs ResolvedName) Source # bindToConcrete :: ResolvedName -> (ConOfAbs ResolvedName -> AbsToCon b) -> AbsToCon b Source # | |||||
NFData ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: ResolvedName -> () | |||||
Generic ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: ResolvedName -> Rep ResolvedName x to :: Rep ResolvedName x -> ResolvedName | |||||
Show ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> ResolvedName -> ShowS show :: ResolvedName -> String showList :: [ResolvedName] -> ShowS | |||||
Eq ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base (==) :: ResolvedName -> ResolvedName -> Bool (/=) :: ResolvedName -> ResolvedName -> Bool | |||||
type ConOfAbs ResolvedName Source # | |||||
Defined in Agda.Syntax.Translation.AbstractToConcrete | |||||
type Rep ResolvedName Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep ResolvedName = D1 ('MetaData "ResolvedName" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) ((C1 ('MetaCons "VarName" 'PrefixI 'True) (S1 ('MetaSel ('Just "resolvedVar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Just "resolvedBindingSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BindingSource)) :+: (C1 ('MetaCons "DefinedName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Access) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbstractName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Suffix))) :+: C1 ('MetaCons "FieldName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List1 AbstractName))))) :+: (C1 ('MetaCons "ConstructorName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Induction)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List1 AbstractName))) :+: (C1 ('MetaCons "PatternSynResName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List1 AbstractName))) :+: C1 ('MetaCons "UnknownName" 'PrefixI 'False) (U1 :: Type -> Type)))) |
data AmbiguousNameReason Source #
Why is a resolved name ambiguous? What did it resolve to?
Invariant (statically enforced): At least two resolvents in total.
AmbiguousLocalVar LocalVar (List1 AbstractName) | The name resolves both to a local variable and some declared names. |
AmbiguousDeclName (List2 AbstractName) | The name resolves to at least 2 declared names. |
Instances
NFData AmbiguousNameReason Source # | |||||
Defined in Agda.Syntax.Scope.Base rnf :: AmbiguousNameReason -> () | |||||
Generic AmbiguousNameReason Source # | |||||
Defined in Agda.Syntax.Scope.Base
from :: AmbiguousNameReason -> Rep AmbiguousNameReason x to :: Rep AmbiguousNameReason x -> AmbiguousNameReason | |||||
Show AmbiguousNameReason Source # | |||||
Defined in Agda.Syntax.Scope.Base showsPrec :: Int -> AmbiguousNameReason -> ShowS show :: AmbiguousNameReason -> String showList :: [AmbiguousNameReason] -> ShowS | |||||
type Rep AmbiguousNameReason Source # | |||||
Defined in Agda.Syntax.Scope.Base type Rep AmbiguousNameReason = D1 ('MetaData "AmbiguousNameReason" "Agda.Syntax.Scope.Base" "Agda-2.6.20240731-inplace" 'False) (C1 ('MetaCons "AmbiguousLocalVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List1 AbstractName))) :+: C1 ('MetaCons "AmbiguousDeclName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (List2 AbstractName)))) |
ambiguousNamesInReason :: AmbiguousNameReason -> List2 QName Source #
The flat list of ambiguous names in AmbiguousNameReason
.
data WhyInScopeData Source #
WhyInScopeData | |
|
Operations on name and module maps.
mergeNames :: Eq a => ThingsInScope a -> ThingsInScope a -> ThingsInScope a Source #
mergeNamesMany :: Eq a => [ThingsInScope a] -> ThingsInScope a Source #
Operations on name spaces
emptyNameSpace :: NameSpace Source #
The empty name space.
mapNameSpace :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> NameSpace -> NameSpace Source #
Map functions over the names and modules in a name space.
zipNameSpace :: (NamesInScope -> NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> NameSpace -> NameSpace -> NameSpace Source #
Zip together two name spaces.
mapNameSpaceM :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> NameSpace -> m NameSpace Source #
Map monadic function over a namespace.
General operations on scopes
emptyScope :: Scope Source #
The empty scope.
emptyScopeInfo :: ScopeInfo Source #
The empty scope info.
mapScope :: (NameSpaceId -> NamesInScope -> NamesInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet) -> Scope -> Scope Source #
Map functions over the names and modules in a scope.
mapScope_ :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope Source #
Same as mapScope
but applies the same function to all name spaces.
mapScopeNS :: NameSpaceId -> (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope Source #
Same as mapScope
but applies the function only on the given name space.
mapScopeM :: Applicative m => (NameSpaceId -> NamesInScope -> m NamesInScope) -> (NameSpaceId -> ModulesInScope -> m ModulesInScope) -> (NameSpaceId -> InScopeSet -> m InScopeSet) -> Scope -> m Scope Source #
Map monadic functions over the names and modules in a scope.
mapScopeM_ :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> Scope -> m Scope Source #
Same as mapScopeM
but applies the same function to both the public and
private name spaces.
zipScope :: (NameSpaceId -> NamesInScope -> NamesInScope -> NamesInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope Source #
Zip together two scopes. The resulting scope has the same name as the first scope.
zipScope_ :: (NamesInScope -> NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope Source #
Same as zipScope
but applies the same function to both the public and
private name spaces.
recomputeInScopeSets :: Scope -> Scope Source #
Recompute the inScope sets of a scope.
filterScope :: (Name -> Bool) -> (Name -> Bool) -> Scope -> Scope Source #
Filter a scope keeping only concrete names matching the predicates. The first predicate is applied to the names and the second to the modules.
allNamesInScope :: InScope a => Scope -> ThingsInScope a Source #
Return all names in a scope.
allNamesInScope' :: InScope a => Scope -> ThingsInScope (a, Access) Source #
findNameInScope :: InScope a => Name -> Scope -> [(a, Access)] Source #
Look up a single name in the current scope.
This is equivalent to Map.lookup n . allNamesInScope'
, but more efficient
when only a single name needs to be looked up.
exportedNamesInScope :: InScope a => Scope -> ThingsInScope a Source #
Returns the scope's non-private names.
namesInScope :: InScope a => [NameSpaceId] -> Scope -> ThingsInScope a Source #
allThingsInScope :: Scope -> NameSpace Source #
thingsInScope :: [NameSpaceId] -> Scope -> NameSpace Source #
mergeScope :: Scope -> Scope -> Scope Source #
Merge two scopes. The result has the name of the first scope.
mergeScopes :: [Scope] -> Scope Source #
Merge a non-empty list of scopes. The result has the name of the first scope in the list.
Specific operations on scopes
setScopeAccess :: NameSpaceId -> Scope -> Scope Source #
Move all names in a scope to the given name space (except never move from Imported to Public).
setNameSpace :: NameSpaceId -> NameSpace -> Scope -> Scope Source #
Update a particular name space.
modifyNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> Scope -> Scope Source #
Modify a particular name space.
addNameToScope :: NameSpaceId -> Name -> AbstractName -> Scope -> Scope Source #
Add a name to a scope.
removeNameFromScope :: NameSpaceId -> Name -> Scope -> Scope Source #
Remove a name from a scope. Caution: does not update the nsInScope set. This is only used by rebindName and in that case we add the name right back (but with a different kind).
addModuleToScope :: NameSpaceId -> Name -> AbstractModule -> Scope -> Scope Source #
Add a module to a scope.
data UsingOrHiding Source #
When we get here we cannot have both using
and hiding
.
applyImportDirective :: ImportDirective -> Scope -> Scope Source #
Apply an ImportDirective
to a scope:
- rename keys (C.Name) according to
renaming
; - for untouched keys, either of
a) remove keys according to hiding
, or
b) filter keys according to using
.
Both steps could be done in one pass, by first preparing key-filtering
functions C.Name -> Maybe C.Name
for defined names and module names.
However, the penalty of doing it in two passes should not be too high.
(Doubling the run time.)
applyImportDirective_ Source #
:: ImportDirective | |
-> Scope | |
-> (Scope, (Set Name, Set Name)) | Merged scope, clashing names, clashing module names. |
Version of applyImportDirective
that also returns sets of name
and module name clashes introduced by renaming
to identifiers
that are already imported by using
or lack of hiding
.
renameCanonicalNames :: Map QName QName -> Map ModuleName ModuleName -> Scope -> Scope Source #
Rename the abstract names in a scope.
restrictPrivate :: Scope -> Scope Source #
Remove private name space of a scope.
Should be a right identity for exportedNamesInScope
.
exportedNamesInScope . restrictPrivate == exportedNamesInScope
.
restrictLocalPrivate :: ModuleName -> Scope -> Scope Source #
Remove private things from the given module from a scope.
disallowGeneralizedVars :: Scope -> Scope Source #
Disallow using generalized variables from the scope
inScopeBecause :: (WhyInScope -> WhyInScope) -> Scope -> Scope Source #
Add an explanation to why things are in scope.
publicModules :: ScopeInfo -> Map ModuleName Scope Source #
Get the public parts of the public modules of a scope
publicNames :: ScopeInfo -> Set AbstractName Source #
publicNamesOfModules :: Map ModuleName Scope -> [AbstractName] Source #
concreteNamesInScope :: ScopeInfo -> Set QName Source #
Get all concrete names in scope. Includes bound variables.
Inverse look-up
data AllowAmbiguousNames Source #
AmbiguousAnything | Used for instance arguments to check whether a name is in scope, but we do not care whether is is ambiguous |
AmbiguousConProjs | Ambiguous constructors, projections, or pattern synonyms. |
AmbiguousNothing |
Instances
Eq AllowAmbiguousNames Source # | |
Defined in Agda.Syntax.Scope.Base (==) :: AllowAmbiguousNames -> AllowAmbiguousNames -> Bool (/=) :: AllowAmbiguousNames -> AllowAmbiguousNames -> Bool |
isNameInScope :: QName -> ScopeInfo -> Bool Source #
isNameInScopeUnqualified :: QName -> ScopeInfo -> Bool Source #
inverseScopeLookupName :: QName -> ScopeInfo -> [QName] Source #
Find the concrete names that map (uniquely) to a given abstract qualified name. Sort by number of modules in the qualified name, unqualified names first.
inverseScopeLookupName' :: AllowAmbiguousNames -> QName -> ScopeInfo -> [QName] Source #
inverseScopeLookupName'' :: AllowAmbiguousNames -> QName -> ScopeInfo -> Maybe NameMapEntry Source #
A version of inverseScopeLookupName
that also delivers the KindOfName
.
Used in highlighting.
inverseScopeLookupModule :: ModuleName -> ScopeInfo -> [QName] Source #
Find the concrete names that map (uniquely) to a given abstract module name. Sort by length, shortest first.
inverseScopeLookupModule' :: AllowAmbiguousNames -> ModuleName -> ScopeInfo -> [QName] Source #
Update binding site
class SetBindingSite a where Source #
Set the nameBindingSite
in an abstract name.
Nothing
setBindingSite :: Range -> a -> a Source #
default setBindingSite :: forall b (t :: Type -> Type). (SetBindingSite b, Functor t, t b ~ a) => Range -> a -> a Source #
Instances
SetBindingSite ModuleName Source # | Sets the binding site of all names in the path. |
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> ModuleName -> ModuleName Source # | |
SetBindingSite Name Source # | |
Defined in Agda.Syntax.Scope.Base | |
SetBindingSite QName Source # | |
Defined in Agda.Syntax.Scope.Base | |
SetBindingSite AbstractModule Source # | |
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> AbstractModule -> AbstractModule Source # | |
SetBindingSite AbstractName Source # | |
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> AbstractName -> AbstractName Source # | |
SetBindingSite a => SetBindingSite (List1 a) Source # | |
Defined in Agda.Syntax.Scope.Base | |
SetBindingSite a => SetBindingSite [a] Source # | |
Defined in Agda.Syntax.Scope.Base setBindingSite :: Range -> [a] -> [a] Source # |
(Debug) printing
prettyNameSpace :: NameSpace -> [Doc] Source #