Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data NotBlocked' t
- data Blocker
- = UnblockOnAll (Set Blocker)
- | UnblockOnAny (Set Blocker)
- | UnblockOnMeta MetaId
- | UnblockOnProblem ProblemId
- | UnblockOnDef QName
- alwaysUnblock :: Blocker
- neverUnblock :: Blocker
- unblockOnAll :: Set Blocker -> Blocker
- unblockOnAny :: Set Blocker -> Blocker
- unblockOnEither :: Blocker -> Blocker -> Blocker
- unblockOnBoth :: Blocker -> Blocker -> Blocker
- unblockOnMeta :: MetaId -> Blocker
- unblockOnProblem :: ProblemId -> Blocker
- unblockOnDef :: QName -> Blocker
- unblockOnAllMetas :: Set MetaId -> Blocker
- unblockOnAnyMeta :: Set MetaId -> Blocker
- onBlockingMetasM :: Monad m => (MetaId -> m Blocker) -> Blocker -> m Blocker
- allBlockingMetas :: Blocker -> Set MetaId
- allBlockingProblems :: Blocker -> Set ProblemId
- allBlockingDefs :: Blocker -> Set QName
- data Blocked' t a
- = Blocked {
- theBlocker :: Blocker
- ignoreBlocking :: a
- | NotBlocked {
- blockingStatus :: NotBlocked' t
- ignoreBlocking :: a
- = Blocked {
- stuckOn :: Elim' t -> NotBlocked' t -> NotBlocked' t
- blockedOn :: Blocker -> a -> Blocked' t a
- blocked :: MetaId -> a -> Blocked' t a
- notBlocked :: a -> Blocked' t a
- blocked_ :: MetaId -> Blocked' t ()
- notBlocked_ :: Blocked' t ()
- getBlocker :: Blocked' t a -> Blocker
- data WakeUp
- = WakeUp
- | DontWakeUp (Maybe Blocker)
- wakeUpWhen :: (constr -> Bool) -> (constr -> WakeUp) -> constr -> WakeUp
- wakeUpWhen_ :: (constr -> Bool) -> constr -> WakeUp
- wakeIfBlockedOnProblem :: ProblemId -> Blocker -> WakeUp
- wakeIfBlockedOnMeta :: MetaId -> Blocker -> WakeUp
- wakeIfBlockedOnDef :: QName -> Blocker -> WakeUp
- unblockMeta :: MetaId -> Blocker -> Blocker
- unblockProblem :: ProblemId -> Blocker -> Blocker
- unblockDef :: QName -> Blocker -> Blocker
Blocked Terms
data NotBlocked' t Source #
Even if we are not stuck on a meta during reduction we can fail to reduce a definition by pattern matching for another reason.
StuckOn (Elim' t) | The |
Underapplied | Not enough arguments were supplied to complete the matching. |
AbsurdMatch | We matched an absurd clause, results in a neutral |
MissingClauses QName | We ran out of clauses for |
ReallyNotBlocked | Reduction was not blocked, we reached a whnf
which can be anything but a stuck |
Instances
EmbPrj NotBlocked Source # | |
Defined in Agda.TypeChecking.Serialise.Instances.Internal icode :: NotBlocked -> S Int32 Source # icod_ :: NotBlocked -> S Int32 Source # value :: Int32 -> R NotBlocked Source # | |
Eq NotBlocked | |
Defined in Agda.TypeChecking.Substitute (==) :: NotBlocked -> NotBlocked -> Bool (/=) :: NotBlocked -> NotBlocked -> Bool | |
Pretty t => Pretty (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers pretty :: NotBlocked' t -> Doc Source # prettyPrec :: Int -> NotBlocked' t -> Doc Source # prettyList :: [NotBlocked' t] -> Doc Source # | |
Monoid (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers mempty :: NotBlocked' t mappend :: NotBlocked' t -> NotBlocked' t -> NotBlocked' t mconcat :: [NotBlocked' t] -> NotBlocked' t | |
Semigroup (NotBlocked' t) Source # |
|
Defined in Agda.Syntax.Internal.Blockers (<>) :: NotBlocked' t -> NotBlocked' t -> NotBlocked' t # sconcat :: NonEmpty (NotBlocked' t) -> NotBlocked' t stimes :: Integral b => b -> NotBlocked' t -> NotBlocked' t | |
Generic (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers type Rep (NotBlocked' t) :: Type -> Type from :: NotBlocked' t -> Rep (NotBlocked' t) x to :: Rep (NotBlocked' t) x -> NotBlocked' t | |
Show t => Show (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers showsPrec :: Int -> NotBlocked' t -> ShowS show :: NotBlocked' t -> String showList :: [NotBlocked' t] -> ShowS | |
NFData t => NFData (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers rnf :: NotBlocked' t -> () | |
type Rep (NotBlocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers type Rep (NotBlocked' t) = D1 ('MetaData "NotBlocked'" "Agda.Syntax.Internal.Blockers" "Agda-2.6.3.20230930-inplace" 'False) ((C1 ('MetaCons "StuckOn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Elim' t))) :+: C1 ('MetaCons "Underapplied" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AbsurdMatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MissingClauses" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName)) :+: C1 ('MetaCons "ReallyNotBlocked" 'PrefixI 'False) (U1 :: Type -> Type)))) |
What is causing the blocking? Or in other words which metas or problems need to be solved to unblock the blocked computation/constraint.
UnblockOnAll (Set Blocker) | |
UnblockOnAny (Set Blocker) | |
UnblockOnMeta MetaId | Unblock if meta is instantiated |
UnblockOnProblem ProblemId | |
UnblockOnDef QName | Unblock when function is defined |
Instances
EncodeTCM Blocker Source # | |
Pretty Blocker Source # | |
MentionsMeta Blocker Source # | |
Defined in Agda.TypeChecking.MetaVars.Mention mentionsMetas :: HashSet MetaId -> Blocker -> Bool Source # | |
PrettyTCM Blocker Source # | |
Defined in Agda.TypeChecking.Pretty | |
ToTerm Blocker Source # | |
Instantiate Blocker Source # | |
Defined in Agda.TypeChecking.Reduce | |
Unquote Blocker Source # | |
Generic Blocker Source # | |
Show Blocker Source # | |
NFData Blocker Source # | |
Defined in Agda.Syntax.Internal.Blockers | |
Eq Blocker Source # | |
Ord Blocker Source # | |
type Rep Blocker Source # | |
Defined in Agda.Syntax.Internal.Blockers type Rep Blocker = D1 ('MetaData "Blocker" "Agda.Syntax.Internal.Blockers" "Agda-2.6.3.20230930-inplace" 'False) ((C1 ('MetaCons "UnblockOnAll" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Blocker))) :+: C1 ('MetaCons "UnblockOnAny" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Blocker)))) :+: (C1 ('MetaCons "UnblockOnMeta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MetaId)) :+: (C1 ('MetaCons "UnblockOnProblem" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProblemId)) :+: C1 ('MetaCons "UnblockOnDef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName))))) |
unblockOnAll :: Set Blocker -> Blocker Source #
unblockOnAny :: Set Blocker -> Blocker Source #
unblockOnMeta :: MetaId -> Blocker Source #
unblockOnProblem :: ProblemId -> Blocker Source #
unblockOnDef :: QName -> Blocker Source #
unblockOnAllMetas :: Set MetaId -> Blocker Source #
unblockOnAnyMeta :: Set MetaId -> Blocker Source #
allBlockingMetas :: Blocker -> Set MetaId Source #
allBlockingProblems :: Blocker -> Set ProblemId Source #
allBlockingDefs :: Blocker -> Set QName Source #
Something where a meta variable may block reduction. Notably a top-level meta is considered blocking. This did not use to be the case (pre Aug 2020).
Blocked | |
| |
NotBlocked | |
|
Instances
EmbPrj Blocked_ Source # | |
MonadError Blocked_ NLM | |
Defined in Agda.TypeChecking.Rewriting.NonLinMatch throwError :: Blocked_ -> NLM a catchError :: NLM a -> (Blocked_ -> NLM a) -> NLM a | |
Pretty a => Pretty (Blocked a) Source # | |
TermLike a => TermLike (Blocked a) Source # | |
KillRange a => KillRange (Blocked a) Source # | |
Defined in Agda.Syntax.Internal killRange :: KillRangeT (Blocked a) Source # | |
PrettyTCM a => PrettyTCM (Blocked a) Source # | |
Defined in Agda.TypeChecking.Pretty | |
Instantiate a => Instantiate (Blocked a) Source # | |
Defined in Agda.TypeChecking.Reduce | |
Apply t => Apply (Blocked t) Source # | |
Subst a => Subst (Blocked a) Source # | |
Defined in Agda.TypeChecking.Substitute applySubst :: Substitution' (SubstArg (Blocked a)) -> Blocked a -> Blocked a Source # | |
Decoration (Blocked' t) Source # | |
Foldable (Blocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers fold :: Monoid m => Blocked' t m -> m foldMap :: Monoid m => (a -> m) -> Blocked' t a -> m foldMap' :: Monoid m => (a -> m) -> Blocked' t a -> m foldr :: (a -> b -> b) -> b -> Blocked' t a -> b foldr' :: (a -> b -> b) -> b -> Blocked' t a -> b foldl :: (b -> a -> b) -> b -> Blocked' t a -> b foldl' :: (b -> a -> b) -> b -> Blocked' t a -> b foldr1 :: (a -> a -> a) -> Blocked' t a -> a foldl1 :: (a -> a -> a) -> Blocked' t a -> a elem :: Eq a => a -> Blocked' t a -> Bool maximum :: Ord a => Blocked' t a -> a minimum :: Ord a => Blocked' t a -> a | |
Traversable (Blocked' t) Source # | |
Defined in Agda.Syntax.Internal.Blockers | |
Applicative (Blocked' t) Source # | Blocking on _all_ blockers. |
Defined in Agda.Syntax.Internal.Blockers | |
Functor (Blocked' t) Source # | |
Eq t => Eq (Blocked t) | |
(Semigroup a, Monoid a) => Monoid (Blocked' t a) Source # | |
Semigroup a => Semigroup (Blocked' t a) Source # | |
Generic (Blocked' t a) Source # | |
(Show t, Show a) => Show (Blocked' t a) Source # | |
(NFData t, NFData a) => NFData (Blocked' t a) Source # | |
Defined in Agda.Syntax.Internal.Blockers | |
type SubstArg (Blocked a) Source # | |
Defined in Agda.TypeChecking.Substitute | |
type Rep (Blocked' t a) Source # | |
Defined in Agda.Syntax.Internal.Blockers type Rep (Blocked' t a) = D1 ('MetaData "Blocked'" "Agda.Syntax.Internal.Blockers" "Agda-2.6.3.20230930-inplace" 'False) (C1 ('MetaCons "Blocked" 'PrefixI 'True) (S1 ('MetaSel ('Just "theBlocker") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Blocker) :*: S1 ('MetaSel ('Just "ignoreBlocking") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "NotBlocked" 'PrefixI 'True) (S1 ('MetaSel ('Just "blockingStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NotBlocked' t)) :*: S1 ('MetaSel ('Just "ignoreBlocking") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
stuckOn :: Elim' t -> NotBlocked' t -> NotBlocked' t Source #
When trying to reduce f es
, on match failed on one
elimination e ∈ es
that came with info r :: NotBlocked
.
stuckOn e r
produces the new NotBlocked
info.
MissingClauses
must be propagated, as this is blockage
that can be lifted in the future (as more clauses are added).
is also propagated, since it provides more
precise information as StuckOn
e0StuckOn e
(as e0
is the original
reason why reduction got stuck and usually a subterm of e
).
An information like StuckOn (Apply (Arg info (Var i [])))
(stuck on a variable) could be used by the lhs/coverage checker
to trigger a split on that (pattern) variable.
In the remaining cases for r
, we are terminally stuck
due to StuckOn e
. Propagating
does not
seem useful.AbsurdMatch
Underapplied
must not be propagated, as this would mean
that f es
is underapplied, which is not the case (it is stuck).
Note that Underapplied
can only arise when projection patterns were
missing to complete the original match (in e
).
(Missing ordinary pattern would mean the e
is of function type,
but we cannot match against something of function type.)
Handling blocked terms.
notBlocked :: a -> Blocked' t a Source #
notBlocked_ :: Blocked' t () Source #
getBlocker :: Blocked' t a -> Blocker Source #
Waking up logic
Should a constraint wake up or not? If not, we might refine the unblocker.
WakeUp | |
DontWakeUp (Maybe Blocker) |
wakeUpWhen :: (constr -> Bool) -> (constr -> WakeUp) -> constr -> WakeUp Source #
wakeUpWhen_ :: (constr -> Bool) -> constr -> WakeUp Source #