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

Safe HaskellNone
LanguageHaskell98

Agda.Syntax.Common

Contents

Description

Some common syntactic entities are defined in this module.

Synopsis

Delayed

data Delayed Source

Used to specify whether something should be delayed.

Constructors

Delayed 
NotDelayed 

Induction

Hiding

class LensHiding a where Source

A lens to access the Hiding attribute in data structures. Minimal implementation: getHiding and one of setHiding or mapHiding.

Minimal complete definition

getHiding

Methods

getHiding :: a -> Hiding Source

setHiding :: Hiding -> a -> a Source

mapHiding :: (Hiding -> Hiding) -> a -> a Source

mergeHiding :: LensHiding a => WithHiding a -> a Source

Monoidal composition of Hiding information in some data.

isHidden :: LensHiding a => a -> Bool Source

isHidden does not apply to Instance, only to Hidden.

notHidden :: LensHiding a => a -> Bool Source

Visible (NotHidden) arguments are notHidden. (DEPRECATED, use visible.)

visible :: LensHiding a => a -> Bool Source

NotHidden arguments are visible.

notVisible :: LensHiding a => a -> Bool Source

Instance and Hidden arguments are notVisible.

hide :: LensHiding a => a -> a Source

Relevance

data Big Source

An constructor argument is big if the sort of its type is bigger than the sort of the data type. Only parameters (and maybe forced arguments) are allowed to be big. List : Set -> Set nil : (A : Set) -> List A A is big in constructor nil as the sort Set1 of its type Set is bigger than the sort Set of the data type List.

Constructors

Big 
Small 

data Relevance Source

A function argument can be relevant or irrelevant. See Agda.TypeChecking.Irrelevance.

Constructors

Relevant

The argument is (possibly) relevant at compile-time.

NonStrict

The argument may never flow into evaluation position. Therefore, it is irrelevant at run-time. It is treated relevantly during equality checking.

Irrelevant

The argument is irrelevant at compile- and runtime.

Forced Big

The argument can be skipped during equality checking because its value is already determined by the type. If a constructor argument is big, it has to be regarded absent, otherwise we get into paradoxes.

UnusedArg

The polarity checker has determined that this argument is unused in the definition. It can be skipped during equality checking but should be mined for solutions of meta-variables with relevance UnusedArg

class LensRelevance a where Source

A lens to access the Relevance attribute in data structures. Minimal implementation: getRelevance and one of setRelevance or mapRelevance.

Minimal complete definition

getRelevance

moreRelevant :: Relevance -> Relevance -> Bool Source

Information ordering. Relevant `moreRelevant` UnusedArg `moreRelevant` Forced `moreRelevant` NonStrict `moreRelevant` Irrelevant

unusableRelevance :: Relevance -> Bool Source

unusableRelevance rel == True iff we cannot use a variable of rel.

composeRelevance :: Relevance -> Relevance -> Relevance Source

Relevance composition. Irrelevant is dominant, Relevant is neutral.

inverseComposeRelevance :: Relevance -> Relevance -> Relevance Source

inverseComposeRelevance r x returns the most irrelevant y such that forall x, y we have x `moreRelevant` (r `composeRelevance` y) iff (r `inverseComposeRelevance` x) `moreRelevant` y (Galois connection).

ignoreForced :: Relevance -> Relevance Source

For comparing Relevance ignoring Forced and UnusedArg.

irrToNonStrict :: Relevance -> Relevance Source

Irrelevant function arguments may appear non-strictly in the codomain type.

Argument decoration

mapArgInfoColors :: ([c] -> [c']) -> ArgInfo c -> ArgInfo c' Source

Arguments

data Arg c e Source

Constructors

Arg 

Fields

argInfo :: ArgInfo c
 
unArg :: e
 

Instances

IsPrefixOf Args Source 
UniverseBi Args Pattern 
UniverseBi Args Term 
Functor (Arg c) Source 
Foldable (Arg c) Source 
Traversable (Arg c) Source 
Decoration (Arg c) Source 
Pretty a => Pretty (Arg a) Source 
ExprLike a => ExprLike (Arg a) Source 
SubstExpr a => SubstExpr (Arg a) Source 
AllNames a => AllNames (Arg a) Source 
TermLike a => TermLike (Arg a) Source 
Free a => Free (Arg a) Source 
Subst a => Subst (Arg a) Source 
AbstractTerm a => AbstractTerm (Arg a) Source 
KillVar a => KillVar (Arg a) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Arg a) Source 
MentionsMeta t => MentionsMeta (Arg t) Source 
InstantiateFull t => InstantiateFull (Arg t) Source 
Normalise t => Normalise (Arg t) Source 
Simplify t => Simplify (Arg t) Source 
Reduce t => Reduce (Arg t) Source 
Instantiate t => Instantiate (Arg t) Source 
Match a => Match (Arg a) Source 
Injectible a => Injectible (Arg a) Source 
Evaluate a => Evaluate (Arg a) Source 
ComputeOccurrences a => ComputeOccurrences (Arg a) Source 
FoldRigid a => FoldRigid (Arg a) Source 
Occurs a => Occurs (Arg a) Source 
NoProjectedVar a => NoProjectedVar (Arg a) Source 
HasPolarity a => HasPolarity (Arg a) Source 
UReduce a => UReduce (Arg a) Source 
Unquote a => Unquote (Arg a) Source 
Free' a c => Free' (Arg a) c Source 
ShrinkC a b => ShrinkC (Arg a) (Arg b) Source 
Reify i a => Reify (Dom i) (Arg a) Source 
Reify i a => Reify (Arg i) (Arg a) Source

Skip reification of implicit and irrelevant args if option is off.

ToAbstract c a => ToAbstract (Arg c) (Arg a) Source 
ToAbstract c a => ToAbstract (NamedArg c) (NamedArg a) Source 
Match a b => Match (Arg a) (Arg b) Source 
PatternFrom a b => PatternFrom (Arg a) (Arg b) Source 
SubstHH a b => SubstHH (Arg a) (Arg b) Source 
ConvColor (Arg e) (Arg e) Source 
(Eq a, Eq c) => Eq (Arg c a) Source 
(Ord c, Ord e) => Ord (Arg c e) Source 
(Show a, Show c) => Show (Arg c a) Source 
(KillRange c, KillRange a) => KillRange (Arg c a) Source 
SetRange a => SetRange (Arg c a) Source 
HasRange a => HasRange (Arg c a) Source 
LensRelevance (Arg c e) Source 
LensHiding (Arg c e) Source 
IsProjP a => IsProjP (Arg c a) Source 
ExprLike a => ExprLike (Arg c a) Source

TODO: currently does not go into colors.

(GetDefs c, GetDefs a) => GetDefs (Arg c a) Source 
(GenC c, GenC a) => GenC (Arg c a) Source 
IsInstantiatedMeta a => IsInstantiatedMeta (Arg c a) Source 
(EmbPrj a, EmbPrj c) => EmbPrj (Arg c a) Source 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Arg c a) Source 
(SynEq a, SynEq c) => SynEq (Arg c a) Source 
IsFlexiblePattern a => IsFlexiblePattern (Arg c a) Source 
ToConcrete a c => ToConcrete (Arg ac a) (Arg c) Source 
LabelPatVars a b i => LabelPatVars (Arg c a) (Arg c b) i Source 

mapArgInfo :: (ArgInfo c -> ArgInfo c') -> Arg c a -> Arg c' a Source

argColors :: Arg c a -> [c] Source

mapArgColors :: ([c] -> [c']) -> Arg c a -> Arg c' a Source

setArgColors :: [c] -> Arg c' a -> Arg c a Source

defaultArg :: a -> Arg c a Source

defaultColoredArg :: ([c], a) -> Arg c a Source

withArgsFrom :: [a] -> [Arg c b] -> [Arg c a] Source

xs `withArgsFrom` args translates xs into a list of Args, using the elements in args to fill in the non-unArg fields.

Precondition: The two lists should have equal length.

withNamedArgsFrom :: [a] -> [NamedArg c b] -> [NamedArg c a] Source

Names

Function type domain

data Dom c e Source

Similar to Arg, but we need to distinguish an irrelevance annotation in a function domain (the domain itself is not irrelevant!) from an irrelevant argument.

Dom is used in Pi of internal syntax, in Context and Telescope. Arg is used for actual arguments (Var, Con, Def etc.) and in Abstract syntax and other situations.

Constructors

Dom 

Fields

domInfo :: ArgInfo c
 
unDom :: e
 

Instances

TeleNoAbs Telescope Source 
TeleNoAbs ListTel Source 
Abstract Telescope Source 
KillVar Telescope Source 
GenC Telescope Source 
AddContext Telescope Source 
PrettyTCM Telescope Source 
EmbPrj Telescope Source 
Reduce Telescope Source 
Instantiate Telescope Source 
DropArgs Telescope Source

NOTE: This creates telescopes with unbound de Bruijn indices.

ShrinkC Telescope Telescope Source 
Reify Telescope Telescope Source 
Functor (Dom c) Source 
Foldable (Dom c) Source 
Traversable (Dom c) Source 
Decoration (Dom c) Source 
SgTel (Dom (ArgName, Type)) Source 
SgTel (Dom Type) Source 
TermLike a => TermLike (Dom a) Source 
Free a => Free (Dom a) Source 
Subst a => Subst (Dom a) Source 
AbstractTerm a => AbstractTerm (Dom a) Source 
KillVar a => KillVar (Dom a) Source 
AddContext (Dom (String, Type)) Source 
AddContext (Dom (Name, Type)) Source 
AddContext (Dom Type) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Dom a) Source 
MentionsMeta t => MentionsMeta (Dom t) Source 
InstantiateFull t => InstantiateFull (Dom t) Source 
Normalise t => Normalise (Dom t) Source 
Simplify t => Simplify (Dom t) Source 
Reduce t => Reduce (Dom t) Source 
Instantiate t => Instantiate (Dom t) Source 
ComputeOccurrences a => ComputeOccurrences (Dom a) Source 
FoldRigid a => FoldRigid (Dom a) Source 
Occurs a => Occurs (Dom a) Source 
HasPolarity a => HasPolarity (Dom a) Source 
Free' a c => Free' (Dom a) c Source 
ShrinkC a b => ShrinkC (Dom a) (Dom b) Source 
Reify i a => Reify (Dom i) (Arg a) Source 
Match a b => Match (Dom a) (Dom b) Source 
PatternFrom a b => PatternFrom (Dom a) (Dom b) Source 
SubstHH a b => SubstHH (Dom a) (Dom b) Source 
ConvColor (Dom e) (Dom e) Source 
(Eq c, Eq e) => Eq (Dom c e) Source 
(Ord c, Ord e) => Ord (Dom c e) Source 
(Show a, Show c) => Show (Dom c a) Source 
(KillRange c, KillRange a) => KillRange (Dom c a) Source 
HasRange a => HasRange (Dom c a) Source 
LensRelevance (Dom c e) Source 
LensHiding (Dom c e) Source 
SgTel (ArgName, Dom Type) Source 
LensSort a => LensSort (Dom c a) Source 
(GetDefs c, GetDefs a) => GetDefs (Dom c a) Source 
(GenC c, GenC a) => GenC (Dom c a) Source 
AddContext ([WithHiding Name], Dom Type) Source 
AddContext ([Name], Dom Type) Source 
AddContext (String, Dom Type) Source 
AddContext (Name, Dom Type) Source 
(EmbPrj a, EmbPrj c) => EmbPrj (Dom c a) Source 
(SynEq a, SynEq c) => SynEq (Dom c a) Source 

mapDomInfo :: (ArgInfo c -> ArgInfo c') -> Dom c a -> Dom c' a Source

domColors :: Dom c a -> [c] Source

argFromDom :: Dom c a -> Arg c a Source

domFromArg :: Arg c a -> Dom c a Source

defaultDom :: a -> Dom c a Source

Named arguments

data Named name a Source

Something potentially carrying a name.

Constructors

Named 

Fields

nameOf :: Maybe name
 
namedThing :: a
 

Instances

Functor (Named name) Source 
Show a => Show (Named_ a) Source 
Foldable (Named name) Source 
Traversable (Named name) Source 
Decoration (Named name) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Named_ a) Source 
ToAbstract c a => ToAbstract (NamedArg c) (NamedArg a) Source 
(Eq name, Eq a) => Eq (Named name a) Source 
(Ord name, Ord a) => Ord (Named name a) Source 
(KillRange name, KillRange a) => KillRange (Named name a) Source 
SetRange a => SetRange (Named name a) Source 
HasRange a => HasRange (Named name a) Source 
ExprLike a => ExprLike (Named name a) Source 
IsProjP a => IsProjP (Named n a) Source 
SubstExpr a => SubstExpr (Named name a) Source 
AllNames a => AllNames (Named name a) Source 
ExprLike a => ExprLike (Named x a) Source 
Subst a => Subst (Named name a) Source 
(EmbPrj s, EmbPrj t) => EmbPrj (Named s t) Source 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Named n a) Source 
InstantiateFull t => InstantiateFull (Named name t) Source 
Normalise t => Normalise (Named name t) Source 
Simplify t => Simplify (Named name t) Source 
IsFlexiblePattern a => IsFlexiblePattern (Named name a) Source 
ToConcrete a c => ToConcrete (Named name a) (Named name c) Source 
Reify i a => Reify (Named n i) (Named n a) Source 
ToAbstract c a => ToAbstract (Named name c) (Named name a) Source 
LabelPatVars a b i => LabelPatVars (Named x a) (Named x b) i Source 

type Named_ = Named RString Source

Standard naming.

unnamed :: a -> Named name a Source

named :: name -> a -> Named name a Source

type NamedArg c a = Arg c (Named_ a) Source

Only Hidden arguments can have names.

namedArg :: NamedArg c a -> a Source

Get the content of a NamedArg.

updateNamedArg :: (a -> b) -> NamedArg c a -> NamedArg c b Source

The functor instance for NamedArg would be ambiguous, so we give it another name here.

Range decoration.

unranged :: a -> Ranged a Source

Thing with no range info.

Raw names (before parsing into name parts).

type RawName = String Source

A RawName is some sort of string.

type RString = Ranged RawName Source

String with range info.

Constructor pattern info

data ConPOrigin Source

Where does the ConP of come from?

Constructors

ConPImplicit

Expanded from an implicit pattern.

ConPCon

User wrote a constructor pattern.

ConPRec

User wrote a record pattern.

Infixity, access, abstract, etc.

data IsInfix Source

Functions can be defined in both infix and prefix style. See LHS.

Constructors

InfixDef 
PrefixDef 

data Access Source

Access modifier.

Constructors

PrivateAccess 
PublicAccess 
OnlyQualified

Visible from outside, but not exported when opening the module Used for qualified constructors.

data IsInstance Source

Is this definition eligible for instance search?

type Nat = Int Source

data NameId Source

The unique identifier of a name. Second argument is the top-level module identifier.

Constructors

NameId Integer Integer 

newtype Constr a Source

Constructors

Constr a 

Interaction meta variables

Termination

data TerminationCheck m Source

Termination check? (Default = True).

Constructors

TerminationCheck

Run the termination checker.

NoTerminationCheck

Skip termination checking (unsafe).

NonTerminating

Treat as non-terminating.

Terminating

Treat as terminating (unsafe). Same effect as NoTerminationCheck.

TerminationMeasure !Range m

Skip termination checking but use measure instead.