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

Safe HaskellNone

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 whereSource

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

Methods

getHiding :: a -> HidingSource

setHiding :: Hiding -> a -> aSource

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

isHidden :: LensHiding a => a -> BoolSource

isHidden does not apply to Instance, only to Hidden.

notHidden :: LensHiding a => a -> BoolSource

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

visible :: LensHiding a => a -> BoolSource

NotHidden arguments are visible.

notVisible :: LensHiding a => a -> BoolSource

Instance and Hidden arguments are notVisible.

hide :: LensHiding a => a -> aSource

Relevance

data Relevance Source

A function argument can be relevant or irrelevant. See 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

The argument can be skipped during equality checking because its value is already determined by the type.

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 whereSource

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

moreRelevant :: Relevance -> Relevance -> BoolSource

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

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

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

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

SubstHH a b => SubstHH (Arg a) (Arg b) 
ConvColor (Arg e) (Arg e) 
(Eq a, Eq c) => Eq (Arg c a) 
(Ord c, Ord e) => Ord (Arg c e) 
(Show a, Show c) => Show (Arg c a) 
Sized a => Sized (Arg c a) 
(KillRange c, KillRange a) => KillRange (Arg c a) 
HasRange a => HasRange (Arg c a) 
LensRelevance (Arg c e) 
LensHiding (Arg c e) 
IsProjP a => IsProjP (Arg c a) 
ExprLike a => ExprLike (Arg c a)

TODO: currently does not go into colors.

(GetDefs c, GetDefs a) => GetDefs (Arg c a) 
(GenC c, GenC a) => GenC (Arg c a) 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Arg c a) 
(EmbPrj a, EmbPrj c) => EmbPrj (Arg c a) 
(SynEq a, SynEq c) => SynEq (Arg c a) 
ToConcrete a c => ToConcrete (Arg ac a) (Arg c) 

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

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

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

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

defaultArg :: a -> Arg c aSource

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

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

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

Typeable2 Dom 
TeleNoAbs Telescope 
TeleNoAbs ListTel 
Abstract Telescope 
KillVar Telescope 
GenC Telescope 
AddContext Telescope 
PrettyTCM Telescope 
DropArgs Telescope

NOTE: This creates telescopes with unbound de Bruijn indices.

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

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

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

argFromDom :: Dom c a -> Arg c aSource

domFromArg :: Arg c a -> Dom c aSource

defaultDom :: a -> Dom c aSource

Named arguments

data Named name a Source

Constructors

Named 

Fields

nameOf :: Maybe name
 
namedThing :: a
 

Instances

Typeable2 Named 
Functor (Named name) 
Foldable (Named name) 
Traversable (Named name) 
Decoration (Named name) 
ToAbstract c a => ToAbstract (NamedArg c) (NamedArg a) 
(Eq name, Eq a) => Eq (Named name a) 
(Ord name, Ord a) => Ord (Named name a) 
Show a => Show (Named RString a) 
Sized a => Sized (Named name a) 
Pretty e => Pretty (Named RString e) 
(KillRange name, KillRange a) => KillRange (Named name a) 
HasRange a => HasRange (Named name a) 
IsProjP a => IsProjP (Named n a) 
ExprLike a => ExprLike (Named x a) 
ExprLike a => ExprLike (Named name a) 
Subst a => Subst (Named name a) 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Named RString a) 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Named n a) 
InstantiateFull t => InstantiateFull (Named name t) 
Normalise t => Normalise (Named name t) 
Simplify t => Simplify (Named name t) 
(EmbPrj s, EmbPrj t) => EmbPrj (Named s t) 
ToConcrete a c => ToConcrete (Named name a) (Named name c) 
ToAbstract c a => ToAbstract (Named name c) (Named name a) 
Reify i a => Reify (Named n i) (Named n a) 

unnamed :: a -> Named name aSource

named :: name -> a -> Named name aSource

type NamedArg c a = Arg c (Named RString a)Source

Only Hidden arguments can have names.

namedArg :: NamedArg c a -> aSource

Get the content of a NamedArg.

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

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

Range decoration.

data Ranged a Source

Thing with range info.

Constructors

Ranged 

Fields

rangeOf :: Range
 
rangedThing :: a
 

unranged :: a -> Ranged aSource

Thing with no range info.

type RString = Ranged StringSource

String with range info.

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.

type Nat = IntSource

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