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

Safe HaskellNone
LanguageHaskell2010

Agda.Syntax.Abstract.Name

Contents

Description

Abstract names carry unique identifiers and stuff.

Synopsis

Documentation

data Name Source #

A name is a unique identifier and a suggestion for a concrete name. The concrete name contains the source location (if any) of the name. The source location of the binding site is also recorded.

Instances

Eq Name Source # 

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Data Name Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name #

toConstr :: Name -> Constr #

dataTypeOf :: Name -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Name) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) #

gmapT :: (forall b. Data b => b -> b) -> Name -> Name #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r #

gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name #

Ord Name Source # 

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source #

Only use this show function in debugging! To convert an abstract Name into a string use prettyShow.

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

NFData Name Source #

The range is not forced.

Methods

rnf :: Name -> () #

Hashable Name Source # 

Methods

hashWithSalt :: Int -> Name -> Int

hash :: Name -> Int

Pretty Name Source # 
KillRange Name Source # 
SetRange Name Source # 

Methods

setRange :: Range -> Name -> Name Source #

HasRange Name Source # 

Methods

getRange :: Name -> Range Source #

IsNoName Name Source #

An abstract name is empty if its concrete name is empty.

Methods

isNoName :: Name -> Bool Source #

NumHoles Name Source # 

Methods

numHoles :: Name -> Int Source #

PrettyTCM Name Source # 

Methods

prettyTCM :: Name -> TCM Doc Source #

AddContext Name Source # 

Methods

addContext :: (MonadTCM tcm, MonadDebug tcm) => Name -> tcm a -> tcm a Source #

contextSize :: Name -> Nat Source #

InstantiateFull Name Source # 
ToConcrete Name Name Source # 
Reify Name Name Source # 
Suggest Name (Abs b) Source # 

Methods

suggest :: Name -> Abs b -> String Source #

ToAbstract Pattern (Names, Pattern) Source # 
AddContext (Dom (Name, Type)) Source # 

Methods

addContext :: (MonadTCM tcm, MonadDebug tcm) => Dom (Name, Type) -> tcm a -> tcm a Source #

contextSize :: Dom (Name, Type) -> Nat Source #

ToAbstract (NewName Name) Name Source # 
ToAbstract (NewName BoundName) Name Source # 
(Free i, Reify i a) => Reify (Abs i) (Name, a) Source # 

Methods

reify :: Abs i -> TCM (Name, a) Source #

reifyWhen :: Bool -> Abs i -> TCM (Name, a) Source #

ToAbstract r a => ToAbstract (Abs r) (a, Name) Source # 

Methods

toAbstract :: Abs r -> WithNames (a, Name) Source #

AddContext ([WithHiding Name], Dom Type) Source # 

Methods

addContext :: (MonadTCM tcm, MonadDebug tcm) => ([WithHiding Name], Dom Type) -> tcm a -> tcm a Source #

contextSize :: ([WithHiding Name], Dom Type) -> Nat Source #

AddContext ([Name], Dom Type) Source # 

Methods

addContext :: (MonadTCM tcm, MonadDebug tcm) => ([Name], Dom Type) -> tcm a -> tcm a Source #

contextSize :: ([Name], Dom Type) -> Nat Source #

AddContext (Name, Dom Type) Source # 

Methods

addContext :: (MonadTCM tcm, MonadDebug tcm) => (Name, Dom Type) -> tcm a -> tcm a Source #

contextSize :: (Name, Dom Type) -> Nat Source #

ToAbstract r Expr => ToAbstract (Dom r, Name) TypedBindings Source # 

data QName Source #

Qualified names are non-empty lists of names. Equality on qualified names are just equality on the last name, i.e. the module part is just for show.

The SetRange instance for qualified names sets all individual ranges (including those of the module prefix) to the given one.

Constructors

QName 

Instances

Eq QName Source # 

Methods

(==) :: QName -> QName -> Bool #

(/=) :: QName -> QName -> Bool #

Data QName Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> QName -> c QName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c QName #

toConstr :: QName -> Constr #

dataTypeOf :: QName -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c QName) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName) #

gmapT :: (forall b. Data b => b -> b) -> QName -> QName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r #

gmapQ :: (forall d. Data d => d -> u) -> QName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> QName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> QName -> m QName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName #

Ord QName Source # 

Methods

compare :: QName -> QName -> Ordering #

(<) :: QName -> QName -> Bool #

(<=) :: QName -> QName -> Bool #

(>) :: QName -> QName -> Bool #

(>=) :: QName -> QName -> Bool #

max :: QName -> QName -> QName #

min :: QName -> QName -> QName #

Show QName Source #

Only use this show function in debugging! To convert an abstract QName into a string use prettyShow.

Methods

showsPrec :: Int -> QName -> ShowS #

show :: QName -> String #

showList :: [QName] -> ShowS #

NFData QName Source # 

Methods

rnf :: QName -> () #

Hashable QName Source # 

Methods

hashWithSalt :: Int -> QName -> Int

hash :: QName -> Int

Pretty QName Source # 
Sized QName Source # 

Methods

size :: QName -> Int Source #

KillRange QName Source # 
KillRange RewriteRuleMap Source # 
KillRange Definitions Source # 
SetRange QName Source # 

Methods

setRange :: Range -> QName -> QName Source #

HasRange QName Source # 

Methods

getRange :: QName -> Range Source #

NumHoles QName Source # 

Methods

numHoles :: QName -> Int Source #

TermLike QName Source # 

Methods

traverseTermM :: Monad m => (Term -> m Term) -> QName -> m QName Source #

foldTerm :: Monoid m => (Term -> m) -> QName -> m Source #

AllNames QName Source # 
ExprLike QName Source # 

Methods

recurseExpr :: Applicative m => (Expr -> m Expr -> m Expr) -> QName -> m QName Source #

foldExpr :: Monoid m => (Expr -> m) -> QName -> m Source #

traverseExpr :: (Applicative m, Monad m) => (Expr -> m Expr) -> QName -> m QName Source #

mapExpr :: (Expr -> Expr) -> QName -> QName Source #

PrettyTCM QName Source # 

Methods

prettyTCM :: QName -> TCM Doc Source #

NamesIn QName Source # 

Methods

namesIn :: QName -> Set QName Source #

InstantiateFull QName Source # 
FromTerm QName Source # 
ToTerm QName Source # 
PrimTerm QName Source # 

Methods

primTerm :: QName -> TCM Term Source #

Occurs QName Source # 
Unquote QName Source # 
UniverseBi Declaration QName 
Subst Term QName Source # 
ToConcrete QName QName Source # 
Conversion TOM Clause (Maybe ([Pat O], MExp O)) Source # 

Methods

convert :: Clause -> TOM (Maybe ([Pat O], MExp O)) Source #

Conversion TOM Type (MExp O) Source # 

Methods

convert :: Type -> TOM (MExp O) Source #

Conversion TOM Term (MExp O) Source # 

Methods

convert :: Term -> TOM (MExp O) Source #

Conversion TOM Args (MM (ArgList O) (RefInfo O)) Source # 

Methods

convert :: Args -> TOM (MM (ArgList O) (RefInfo O)) Source #

Conversion MOT (Exp O) Type Source # 

Methods

convert :: Exp O -> MOT Type Source #

Conversion MOT (Exp O) Term Source # 

Methods

convert :: Exp O -> MOT Term Source #

Conversion TOM [Clause] [([Pat O], MExp O)] Source # 

Methods

convert :: [Clause] -> TOM [([Pat O], MExp O)] Source #

Conversion TOM (Arg Pattern) (Pat O) Source # 

Methods

convert :: Arg Pattern -> TOM (Pat O) Source #

Conversion MOT a b => Conversion MOT (MM a (RefInfo O)) b Source # 

Methods

convert :: MM a (RefInfo O) -> MOT b Source #

(Show a, ToQName a) => ToAbstract (OldName a) QName Source # 
ToConcrete (Maybe QName) (Maybe Name) Source # 

data QNamed a Source #

Something preceeded by a qualified name.

Constructors

QNamed 

Fields

Instances

Functor QNamed Source # 

Methods

fmap :: (a -> b) -> QNamed a -> QNamed b #

(<$) :: a -> QNamed b -> QNamed a #

Foldable QNamed Source # 

Methods

fold :: Monoid m => QNamed m -> m #

foldMap :: Monoid m => (a -> m) -> QNamed a -> m #

foldr :: (a -> b -> b) -> b -> QNamed a -> b #

foldr' :: (a -> b -> b) -> b -> QNamed a -> b #

foldl :: (b -> a -> b) -> b -> QNamed a -> b #

foldl' :: (b -> a -> b) -> b -> QNamed a -> b #

foldr1 :: (a -> a -> a) -> QNamed a -> a #

foldl1 :: (a -> a -> a) -> QNamed a -> a #

toList :: QNamed a -> [a] #

null :: QNamed a -> Bool #

length :: QNamed a -> Int #

elem :: Eq a => a -> QNamed a -> Bool #

maximum :: Ord a => QNamed a -> a #

minimum :: Ord a => QNamed a -> a #

sum :: Num a => QNamed a -> a #

product :: Num a => QNamed a -> a #

Traversable QNamed Source # 

Methods

traverse :: Applicative f => (a -> f b) -> QNamed a -> f (QNamed b) #

sequenceA :: Applicative f => QNamed (f a) -> f (QNamed a) #

mapM :: Monad m => (a -> m b) -> QNamed a -> m (QNamed b) #

sequence :: Monad m => QNamed (m a) -> m (QNamed a) #

Show a => Show (QNamed a) Source #

Use prettyShow to print names to the user.

Methods

showsPrec :: Int -> QNamed a -> ShowS #

show :: QNamed a -> String #

showList :: [QNamed a] -> ShowS #

Pretty a => Pretty (QNamed a) Source # 
PrettyTCM (QNamed Clause) Source # 
Reify (QNamed Clause) Clause Source # 
ToAbstract (QNamed Clause) Clause Source # 
ToAbstract [QNamed Clause] [Clause] Source # 

newtype ModuleName Source #

A module name is just a qualified name.

The SetRange instance for module names sets all individual ranges to the given one.

Constructors

MName 

Fields

Instances

Eq ModuleName Source # 
Data ModuleName Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ModuleName -> c ModuleName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ModuleName #

toConstr :: ModuleName -> Constr #

dataTypeOf :: ModuleName -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ModuleName) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ModuleName) #

gmapT :: (forall b. Data b => b -> b) -> ModuleName -> ModuleName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ModuleName -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ModuleName -> r #

gmapQ :: (forall d. Data d => d -> u) -> ModuleName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

Ord ModuleName Source # 
Show ModuleName Source #

Only use this show function in debugging! To convert an abstract ModuleName into a string use prettyShow.

NFData ModuleName Source # 

Methods

rnf :: ModuleName -> () #

Pretty ModuleName Source # 
Sized ModuleName Source # 

Methods

size :: ModuleName -> Int Source #

KillRange ModuleName Source # 
KillRange Sections Source # 
SetRange ModuleName Source # 
HasRange ModuleName Source # 
SubstExpr ModuleName Source # 
ExprLike ModuleName Source # 
PrettyTCM ModuleName Source # 
InstantiateFull ModuleName Source # 
UniverseBi Declaration ModuleName 
ToConcrete ModuleName QName Source # 
ToAbstract OldModuleName ModuleName Source # 
ToAbstract NewModuleQName ModuleName Source # 
ToAbstract NewModuleName ModuleName Source # 
ToAbstract ModuleAssignment (ModuleName, [LetBinding]) Source # 

newtype AmbiguousQName Source #

Ambiguous qualified names. Used for overloaded constructors.

Invariant: All the names in the list must have the same concrete, unqualified name. (This implies that they all have the same Range).

Constructors

AmbQ 

Instances

Eq AmbiguousQName Source # 
Data AmbiguousQName Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AmbiguousQName -> c AmbiguousQName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AmbiguousQName #

toConstr :: AmbiguousQName -> Constr #

dataTypeOf :: AmbiguousQName -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c AmbiguousQName) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AmbiguousQName) #

gmapT :: (forall b. Data b => b -> b) -> AmbiguousQName -> AmbiguousQName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AmbiguousQName -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AmbiguousQName -> r #

gmapQ :: (forall d. Data d => d -> u) -> AmbiguousQName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> AmbiguousQName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> AmbiguousQName -> m AmbiguousQName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AmbiguousQName -> m AmbiguousQName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AmbiguousQName -> m AmbiguousQName #

Ord AmbiguousQName Source # 
Show AmbiguousQName Source # 
Pretty AmbiguousQName Source # 
KillRange AmbiguousQName Source # 
HasRange AmbiguousQName Source #

The range of an AmbiguousQName is the range of any of its disambiguations (they are the same concrete name).

NumHoles AmbiguousQName Source #

We can have an instance for ambiguous names as all share a common concrete name.

NamesIn AmbiguousQName Source # 
UniverseBi Declaration AmbiguousQName 

unambiguous :: QName -> AmbiguousQName Source #

A singleton "ambiguous" name.

headAmbQ :: AmbiguousQName -> QName Source #

Get the first of the ambiguous names.

isAmbiguous :: AmbiguousQName -> Bool Source #

Is a name ambiguous.

getUnambiguous :: AmbiguousQName -> Maybe QName Source #

Get the name if unambiguous.

class IsProjP a where Source #

Check whether we are a projection pattern.

Minimal complete definition

isProjP

isAnonymousModuleName :: ModuleName -> Bool Source #

A module is anonymous if the qualification path ends in an underscore.

withRangesOf :: ModuleName -> [Name] -> ModuleName Source #

Sets the ranges of the individual names in the module name to match those of the corresponding concrete names. If the concrete names are fewer than the number of module name name parts, then the initial name parts get the range noRange.

C.D.E `withRangesOf` [A, B] returns C.D.E but with ranges set as follows:

  • C: noRange.
  • D: the range of A.
  • E: the range of B.

Precondition: The number of module name name parts has to be at least as large as the length of the list.

withRangesOfQ :: ModuleName -> QName -> ModuleName Source #

Like withRangesOf, but uses the name parts (qualifier + name) of the qualified name as the list of concrete names.

class MkName a where Source #

Make a Name from some kind of string.

Minimal complete definition

mkName

Methods

mkName :: Range -> NameId -> a -> Name Source #

The Range sets the definition site of the name, not the use site.

mkName_ :: NameId -> a -> Name Source #

qnameToConcrete :: QName -> QName Source #

Turn a qualified name into a concrete name. This should only be used as a fallback when looking up the right concrete name in the scope fails.

toTopLevelModuleName :: ModuleName -> TopLevelModuleName Source #

Computes the TopLevelModuleName corresponding to the given module name, which is assumed to represent a top-level module name.

Precondition: The module name must be well-formed.

qualify_ :: Name -> QName Source #

Convert a Name to a QName (add no module name).

isOperator :: QName -> Bool Source #

Is the name an operator?

nextName :: Name -> Name Source #

Get the next version of the concrete name. For instance, nextName "x" = "x₁". The name must not be a NoName.

Important instances: Eq, Ord, Hashable

IsNoName instances (checking for "_")

Show instances (only for debug printing!)

Pretty instances

Range instances

HasRange

SetRange

KillRange

Sized instances

NFData instances

class IsNoName a where Source #

Check whether a name is the empty name "_".

Minimal complete definition

isNoName

Methods

isNoName :: a -> Bool Source #

Instances

IsNoName String Source # 

Methods

isNoName :: String -> Bool Source #

IsNoName ByteString Source # 
IsNoName QName Source # 

Methods

isNoName :: QName -> Bool Source #

IsNoName Name Source # 

Methods

isNoName :: Name -> Bool Source #

IsNoName Name Source #

An abstract name is empty if its concrete name is empty.

Methods

isNoName :: Name -> Bool Source #