rzk-0.11.4: An experimental proof assistant for synthetic ∞-categories
Safe HaskellNone
LanguageHaskell2010

Rzk.Check.Monad

Contents

Description

The checker's monad: a reader of the context and a state of what the run records (holes and warnings), with errors raised in their context. The context keeps the diagnostics: the stack of judgements and the location narrowed to the term a judgement is about.

Synopsis

Documentation

data Check (n :: S) a Source #

The checker's monad.

Instances

Instances details
Applicative (Check n) Source # 
Instance details

Defined in Rzk.Check.Monad

Methods

pure :: a -> Check n a #

(<*>) :: Check n (a -> b) -> Check n a -> Check n b #

liftA2 :: (a -> b -> c) -> Check n a -> Check n b -> Check n c #

(*>) :: Check n a -> Check n b -> Check n b #

(<*) :: Check n a -> Check n b -> Check n a #

Functor (Check n) Source # 
Instance details

Defined in Rzk.Check.Monad

Methods

fmap :: (a -> b) -> Check n a -> Check n b #

(<$) :: a -> Check n b -> Check n a #

Monad (Check n) Source # 
Instance details

Defined in Rzk.Check.Monad

Methods

(>>=) :: Check n a -> (a -> Check n b) -> Check n b #

(>>) :: Check n a -> Check n b -> Check n b #

return :: a -> Check n a #

data CheckLog Source #

What a run records: the holes, warnings, and hints it found, newest first.

Constructors

CheckLog 

runCheck :: forall (n :: S) a. Context n -> Check n a -> (Either ErrorInContext a, CheckLog) Source #

askContext :: forall (n :: S). Check n (Context n) Source #

inContext :: forall (l :: S) a (n :: S). Context l -> Check l a -> Check n a Source #

Run a judgement in another scope's context.

localContext :: forall (n :: S) a. (Context n -> Context n) -> Check n a -> Check n a Source #

failWith :: forall (n :: S) a. Distinct n => TypeError n -> Check n a Source #

Raise an error, in the current context.

attempt :: forall (n :: S) a. Check n a -> Check n (Either ErrorInContext a) Source #

Run a judgement for its outcome, keeping what it recorded.

performing :: forall (n :: S) a. Distinct n => Action n -> Check n a -> Check n a Source #

Run a judgement as an action on the stack, with the location narrowed to the term it is about.

recordWarning :: forall (n :: S). (Context n -> Warning) -> Check n () Source #

Record a warning, rendered from the context, once.

recordHint :: forall (n :: S). (Context n -> Hint) -> Check n () Source #

Record a hint, rendered from the context, once.

recordHole :: forall (n :: S). (Context n -> HoleInfo) -> Check n () Source #

Record a hole, rendered from the context.

Helpers

asksContext :: forall (n :: S) a. (Context n -> a) -> Check n a Source #

withLocation :: forall (n :: S) a. LocationInfo -> Check n a -> Check n a Source #

withOptions :: forall (n :: S) a. (Options -> Options) -> Check n a -> Check n a Source #

issueTypeError :: forall (n :: S) a. Distinct n => TypeError n -> Check n a Source #

underTope :: forall (n :: S) a. Tope n -> Check n a -> Check n a Source #

Run a judgement with a tope assumed.

withVarianceM :: forall (n :: S) a. Variance -> Check n a -> Check n a Source #