Agda-2.5.1.2: A dependently typed functional programming language and proof assistant

Description

Synopsis

type ScopeM = TCM Source #

To simplify interaction between scope checking and type checking (in particular when chasing imports), we use the same monad.

# General operations

Create a new module with an empty scope (Bool is True if it is a datatype module)

Apply a function to the scope map.

modifyNamedScope :: ModuleName -> (Scope -> Scope) -> ScopeM () Source #

Apply a function to the given scope.

modifyNamedScopeM :: ModuleName -> (Scope -> ScopeM (a, Scope)) -> ScopeM a Source #

Apply a monadic function to the top scope.

modifyCurrentScope :: (Scope -> Scope) -> ScopeM () Source #

Apply a function to the current scope.

Apply a function to the public or private name space.

Run a computation without changing the local variables.

# Names

Create a fresh abstract name from a concrete name.

This function is used when we translate a concrete name in a binder. The Range of the concrete name is saved as the nameBindingSite of the abstract name.

freshAbstractName_ = freshAbstractName noFixity'

Create a fresh abstract qualified name.

# Resolving names

Constructors

 VarName Name DefinedName Access AbstractName FieldName AbstractName record fields names need to be distinguished to parse copatterns ConstructorName [AbstractName] PatternSynResName AbstractName UnknownName

Instances

 Source # Methods Source # MethodsshowList :: [ResolvedName] -> ShowS #

Look up the abstract name referred to by a given concrete name.

Look up the abstract name corresponding to a concrete name of a certain kind and/or from a given set of names. Sometimes we know already that we are dealing with a constructor or pattern synonym (e.g. when we have parsed a pattern). Then, we can ignore conflicting definitions of that name of a different kind. (See issue 822.)

Look up a module in the scope.

Arguments

 :: QName -> Set Name The name must correspond to one of the names in this set. -> ScopeM NewNotation

Get the notation of a name. The name is assumed to be in scope.

# Binding names

Bind a variable. The abstract name is supplied as the second argument.

bindName :: Access -> KindOfName -> Name -> QName -> ScopeM () Source #

Bind a defined name. Must not shadow anything.

rebindName :: Access -> KindOfName -> Name -> QName -> ScopeM () Source #

Rebind a name. Use with care! Ulf, 2014-06-29: Currently used to rebind the name defined by an unquoteDecl, which is a QuotableName in the body, but a DefinedName later on.

Bind a module name.

Bind a qualified module name. Adds it to the imports field of the scope.

# Module manipulation operations

Clear the scope of any no names.

Create a new scope with the given name from an old scope. Renames public names in the old scope to match the new name and returns the renamings.

Apply an import directive and check that all the names mentioned actually exist.

lookupImportedName :: (Eq a, Eq b) => ImportedName' a b -> [ImportedName' (a, c) (b, d)] -> ImportedName' c d Source #

A finite map for ImportedNames.

Arguments

 :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] Translation of imported names. -> [ImportedName' (a, c) (b, d)] Translation of names defined by this import. -> ImportDirective' a b -> ImportDirective' c d

Translation of ImportDirective.

Arguments

 :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] Translation of names in using or hiding list. -> Using' a b -> Using' c d

Translation of Using or Hiding.

Arguments

 :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] Translation of renFrom names. -> [ImportedName' (a, c) (b, d)] Translation of rento names. -> Renaming' a b -> Renaming' c d

Translation of Renaming.

Open a module.