plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver

Synopsis

Documentation

class Breakpointable ann bps | ann → bps where Source #

Leave abstract the types of annotation and breakpoints. The only thing the driver requires is an inclusion relation of breakpoints into the Annotation

Methods

hasBreakpoints ∷ ann → bps → Bool Source #

data CekState uni fun ann Source #

Instances

Instances details
Pretty (CekState uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal

Methods

prettyCekState uni fun ann → Doc ann0 Source #

prettyList ∷ [CekState uni fun ann] → Doc ann0 Source #

data Cmd bps Source #

The commands that the driver may receive from the client (tui,cli,test,etc)

Constructors

Step

Instruct the driver to a *SINGLE* step. Note: No need to pass breakpoints here because the stepping granularity is *minimal*.

Continue bps

Instruct to multi-step until end-of-program or until breakpoint reached

Next bps

Instruct to multi-step over the function call at point or until breakpoint reached

Finish bps

Instruct to multi-step to end of current function or until breakpoint reached

Instances

Instances details
Read bps ⇒ Read (Cmd bps) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver

Show bps ⇒ Show (Cmd bps) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver

Methods

showsPrecIntCmd bps → ShowS Source #

showCmd bps → String Source #

showList ∷ [Cmd bps] → ShowS Source #

runDriverT ∷ ∀ uni fun ann bps m. (Breakpointable ann bps, MonadFree (DebugF uni fun ann bps) m) ⇒ NTerm uni fun ann → m () Source #

Entrypoint of the driver

data DebugF uni fun ann bps a Source #

The drivers's suspension functor

Constructors

InputF (Cmd bps → a)

Await for the client (e.g. TUI) to tell what to do next (Cmd).

DriverLogF Text a

The debug driver wants to log something

StepF

An enumeratee of Driver State (generator+iteratee): Yield a state before doing a step, then await for a state to resume after the step. See Note [Stepping the driver].

Fields

  • (CekState uni fun ann)

    yield with the current driver's state before running a step

  • (CekState uni fun ann → a)

    resume back with a state after the step interpretation | A generator of CekState to yield to client (e.g. TUI)

UpdateClientF (CekState uni fun ann) a 

Instances

Instances details
Functor (DebugF uni fun ann bps) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver

Methods

fmap ∷ (a → b) → DebugF uni fun ann bps a → DebugF uni fun ann bps b Source #

(<$) ∷ a → DebugF uni fun ann bps b → DebugF uni fun ann bps a Source #

Reexport some functions for convenience

mkCekTrans ∷ ∀ cost uni fun ann m s. (ThrowableBuiltins uni fun, PrimMonad m, s ~ PrimState m) ⇒ MachineParameters CekMachineCosts fun (CekValue uni fun ann) → ExBudgetMode cost uni fun → EmitterMode uni fun → Slippage → m (CekTrans uni fun ann s, ExBudgetInfo cost uni fun s) Source #

Based on the supplied arguments, initialize the CEK environment and construct a state transition function. Returns the constructed transition function paired with the methods to live access the running budget.

type CekTrans uni fun ann s = Trans (CekM uni fun s) (CekState uni fun ann) Source #

class Monad m ⇒ MonadFree (f ∷ TypeType) (m ∷ TypeType) | m → f Source #

Monads provide substitution (fmap) and renormalization (join):

m >>= f = join (fmap f m)

A free Monad is one that does no work during the normalization step beyond simply grafting the two monadic values together.

[] is not a free Monad (in this sense) because join [[a]] smashes the lists flat.

On the other hand, consider:

data Tree a = Bin (Tree a) (Tree a) | Tip a
instance Monad Tree where
  return = Tip
  Tip a >>= f = f a
  Bin l r >>= f = Bin (l >>= f) (r >>= f)

This Monad is the free Monad of Pair:

data Pair a = Pair a a

And we could make an instance of MonadFree for it directly:

instance MonadFree Pair Tree where
   wrap (Pair l r) = Bin l r

Or we could choose to program with Free Pair instead of Tree and thereby avoid having to define our own Monad instance.

Moreover, Control.Monad.Free.Church provides a MonadFree instance that can improve the asymptotic complexity of code that constructs free monads by effectively reassociating the use of (>>=). You may also want to take a look at the kan-extensions package (http://hackage.haskell.org/package/kan-extensions).

See Free for a more formal definition of the free Monad for a Functor.

Instances

Instances details
Functor f ⇒ MonadFree f (Free f) 
Instance details

Defined in Control.Monad.Free

Methods

wrap ∷ f (Free f a) → Free f a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (Yoneda m) 
Instance details

Defined in Data.Functor.Yoneda

Methods

wrap ∷ f (Yoneda m a) → Yoneda m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (MaybeT m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (MaybeT m a) → MaybeT m a Source #

(Functor f, Monad m) ⇒ MonadFree f (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

wrap ∷ f (FreeT f m a) → FreeT f m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (ExceptT e m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (ExceptT e m a) → ExceptT e m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (IdentityT m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (IdentityT m a) → IdentityT m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (ReaderT e m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (ReaderT e m a) → ReaderT e m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (StateT s m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (StateT s m a) → StateT s m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (StateT s m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (StateT s m a) → StateT s m a Source #

(Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (WriterT w m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (WriterT w m a) → WriterT w m a Source #

(Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (WriterT w m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (WriterT w m a) → WriterT w m a Source #

(Functor f, MonadFree f m) ⇒ MonadFree f (ContT r m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (ContT r m a) → ContT r m a Source #

(Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (RWST r w s m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (RWST r w s m a) → RWST r w s m a Source #

(Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (RWST r w s m) 
Instance details

Defined in Control.Monad.Free.Class

Methods

wrap ∷ f (RWST r w s m a) → RWST r w s m a Source #

iterM ∷ (Functor f, Monad m) ⇒ (f (m a) → m a) → Free f a → m a Source #

Like iter for monadic values.

iterTM ∷ ∀ f (m ∷ TypeType) t a. (Functor f, Monad m, MonadTrans t, Monad (t m)) ⇒ (f (t m a) → t m a) → FreeT f m a → t m a Source #

Tear down a free monad transformer using iteration over a transformer.

partialIterTMonad m ⇒ Integer → (∀ a. f a → m a) → FreeT f m b → FreeT f m b Source #

partialIterT n phi m interprets first n layers of m using phi. This is sort of the opposite for cutoff.

Some examples (n ≥ 0):

partialIterT 0 _ m              ≡ m
partialIterT (n+1) phi . returnreturn
partialIterT (n+1) phi . liftlift
partialIterT (n+1) phi . wrapjoin . lift . phi

cutoff ∷ ∀ (f ∷ TypeType) (m ∷ TypeType) a. (Functor f, Monad m) ⇒ IntegerFreeT f m a → FreeT f m (Maybe a) Source #

Cuts off a tree of computations at a given depth. If the depth is 0 or less, no computation nor monadic effects will take place.

Some examples (n ≥ 0):

cutoff 0     _        ≡ return Nothing
cutoff (n+1) . returnreturn . Just
cutoff (n+1) . liftlift . liftM Just
cutoff (n+1) . wrapwrap . fmap (cutoff n)

Calling retract . cutoff n is always terminating, provided each of the steps in the iteration is terminating.

data FreeT (f ∷ TypeType) (m ∷ TypeType) a Source #

The "free monad transformer" for a functor f

Instances

Instances details
(Functor f, Monad m) ⇒ MonadFree f (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

wrap ∷ f (FreeT f m a) → FreeT f m a Source #

(Functor f, MonadError e m) ⇒ MonadError e (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwError ∷ e → FreeT f m a Source #

catchErrorFreeT f m a → (e → FreeT f m a) → FreeT f m a Source #

(Functor f, MonadReader r m) ⇒ MonadReader r (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

askFreeT f m r Source #

local ∷ (r → r) → FreeT f m a → FreeT f m a Source #

reader ∷ (r → a) → FreeT f m a Source #

(Functor f, MonadState s m) ⇒ MonadState s (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

getFreeT f m s Source #

put ∷ s → FreeT f m () Source #

state ∷ (s → (a, s)) → FreeT f m a Source #

(Functor f, MonadWriter w m) ⇒ MonadWriter w (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

writer ∷ (a, w) → FreeT f m a Source #

tell ∷ w → FreeT f m () Source #

listenFreeT f m a → FreeT f m (a, w) Source #

passFreeT f m (a, w → w) → FreeT f m a Source #

(Functor f, MonadBase b m) ⇒ MonadBase b (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftBase ∷ b α → FreeT f m α

Functor f ⇒ MonadTrans (FreeT f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftMonad m ⇒ m a → FreeT f m a Source #

(Functor f, MonadFail m) ⇒ MonadFail (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

failStringFreeT f m a Source #

(Functor f, MonadIO m) ⇒ MonadIO (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftIOIO a → FreeT f m a Source #

(Foldable m, Foldable f) ⇒ Foldable (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

foldMonoid m0 ⇒ FreeT f m m0 → m0 Source #

foldMapMonoid m0 ⇒ (a → m0) → FreeT f m a → m0 Source #

foldMap'Monoid m0 ⇒ (a → m0) → FreeT f m a → m0 Source #

foldr ∷ (a → b → b) → b → FreeT f m a → b Source #

foldr' ∷ (a → b → b) → b → FreeT f m a → b Source #

foldl ∷ (b → a → b) → b → FreeT f m a → b Source #

foldl' ∷ (b → a → b) → b → FreeT f m a → b Source #

foldr1 ∷ (a → a → a) → FreeT f m a → a Source #

foldl1 ∷ (a → a → a) → FreeT f m a → a Source #

toListFreeT f m a → [a] Source #

nullFreeT f m a → Bool Source #

lengthFreeT f m a → Int Source #

elemEq a ⇒ a → FreeT f m a → Bool Source #

maximumOrd a ⇒ FreeT f m a → a Source #

minimumOrd a ⇒ FreeT f m a → a Source #

sumNum a ⇒ FreeT f m a → a Source #

productNum a ⇒ FreeT f m a → a Source #

(Eq1 f, Eq1 m) ⇒ Eq1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftEq ∷ (a → b → Bool) → FreeT f m a → FreeT f m b → Bool Source #

(Ord1 f, Ord1 m) ⇒ Ord1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftCompare ∷ (a → b → Ordering) → FreeT f m a → FreeT f m b → Ordering Source #

(Read1 f, Read1 m) ⇒ Read1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftReadsPrec ∷ (IntReadS a) → ReadS [a] → IntReadS (FreeT f m a) Source #

liftReadList ∷ (IntReadS a) → ReadS [a] → ReadS [FreeT f m a] Source #

liftReadPrecReadPrec a → ReadPrec [a] → ReadPrec (FreeT f m a) Source #

liftReadListPrecReadPrec a → ReadPrec [a] → ReadPrec [FreeT f m a] Source #

(Show1 f, Show1 m) ⇒ Show1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftShowsPrec ∷ (Int → a → ShowS) → ([a] → ShowS) → IntFreeT f m a → ShowS Source #

liftShowList ∷ (Int → a → ShowS) → ([a] → ShowS) → [FreeT f m a] → ShowS Source #

(Monad m, Traversable m, Traversable f) ⇒ Traversable (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

traverseApplicative f0 ⇒ (a → f0 b) → FreeT f m a → f0 (FreeT f m b) Source #

sequenceAApplicative f0 ⇒ FreeT f m (f0 a) → f0 (FreeT f m a) Source #

mapMMonad m0 ⇒ (a → m0 b) → FreeT f m a → m0 (FreeT f m b) Source #

sequenceMonad m0 ⇒ FreeT f m (m0 a) → m0 (FreeT f m a) Source #

(Functor f, MonadPlus m) ⇒ Alternative (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

emptyFreeT f m a Source #

(<|>)FreeT f m a → FreeT f m a → FreeT f m a Source #

someFreeT f m a → FreeT f m [a] Source #

manyFreeT f m a → FreeT f m [a] Source #

(Functor f, Monad m) ⇒ Applicative (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

pure ∷ a → FreeT f m a Source #

(<*>)FreeT f m (a → b) → FreeT f m a → FreeT f m b Source #

liftA2 ∷ (a → b → c) → FreeT f m a → FreeT f m b → FreeT f m c Source #

(*>)FreeT f m a → FreeT f m b → FreeT f m b Source #

(<*)FreeT f m a → FreeT f m b → FreeT f m a Source #

(Functor f, Functor m) ⇒ Functor (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fmap ∷ (a → b) → FreeT f m a → FreeT f m b Source #

(<$) ∷ a → FreeT f m b → FreeT f m a Source #

(Functor f, Monad m) ⇒ Monad (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(>>=)FreeT f m a → (a → FreeT f m b) → FreeT f m b Source #

(>>)FreeT f m a → FreeT f m b → FreeT f m b Source #

return ∷ a → FreeT f m a Source #

(Functor f, MonadPlus m) ⇒ MonadPlus (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

mzeroFreeT f m a Source #

mplusFreeT f m a → FreeT f m a → FreeT f m a Source #

(Functor f, MonadCatch m) ⇒ MonadCatch (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

catch ∷ (HasCallStack, Exception e) ⇒ FreeT f m a → (e → FreeT f m a) → FreeT f m a Source #

(Functor f, MonadThrow m) ⇒ MonadThrow (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwM ∷ (HasCallStack, Exception e) ⇒ e → FreeT f m a Source #

(Functor f, MonadCont m) ⇒ MonadCont (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

callCC ∷ ((a → FreeT f m b) → FreeT f m a) → FreeT f m a Source #

(Functor f, Monad m) ⇒ Apply (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(<.>)FreeT f m (a → b) → FreeT f m a → FreeT f m b Source #

(.>)FreeT f m a → FreeT f m b → FreeT f m b Source #

(<.)FreeT f m a → FreeT f m b → FreeT f m a Source #

liftF2 ∷ (a → b → c) → FreeT f m a → FreeT f m b → FreeT f m c Source #

(Functor f, Monad m) ⇒ Bind (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(>>-)FreeT f m a → (a → FreeT f m b) → FreeT f m b Source #

joinFreeT f m (FreeT f m a) → FreeT f m a Source #

(Functor f, Zoom m n s t) ⇒ Zoom (FreeT f m) (FreeT f n) s t 
Instance details

Defined in Control.Lens.Zoom

Methods

zoom ∷ LensLike' (Zoomed (FreeT f m) c) t s → FreeT f m c → FreeT f n c

(Read1 f, Read1 m, Read a) ⇒ Read (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

readsPrecIntReadS (FreeT f m a) Source #

readListReadS [FreeT f m a] Source #

readPrecReadPrec (FreeT f m a) Source #

readListPrecReadPrec [FreeT f m a] Source #

(Show1 f, Show1 m, Show a) ⇒ Show (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

showsPrecIntFreeT f m a → ShowS Source #

showFreeT f m a → String Source #

showList ∷ [FreeT f m a] → ShowS Source #

(Eq1 f, Eq1 m, Eq a) ⇒ Eq (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(==)FreeT f m a → FreeT f m a → Bool Source #

(/=)FreeT f m a → FreeT f m a → Bool Source #

(Ord1 f, Ord1 m, Ord a) ⇒ Ord (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

compareFreeT f m a → FreeT f m a → Ordering Source #

(<)FreeT f m a → FreeT f m a → Bool Source #

(<=)FreeT f m a → FreeT f m a → Bool Source #

(>)FreeT f m a → FreeT f m a → Bool Source #

(>=)FreeT f m a → FreeT f m a → Bool Source #

maxFreeT f m a → FreeT f m a → FreeT f m a Source #

minFreeT f m a → FreeT f m a → FreeT f m a Source #

(Traversable f, Traversable m) ⇒ Plated (FreeT f m a) 
Instance details

Defined in Control.Lens.Plated

Methods

plate ∷ Traversal' (FreeT f m a) (FreeT f m a)

Wrapped (FreeT f m a) 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (FreeT f m a)

Methods

_Wrapped' ∷ Iso' (FreeT f m a) (Unwrapped (FreeT f m a))

(Functor m, Functor f) ⇒ Corecursive (FreeT f m a) 
Instance details

Defined in Data.Functor.Foldable

Methods

embedBase (FreeT f m a) (FreeT f m a) → FreeT f m a Source #

ana ∷ (a0 → Base (FreeT f m a) a0) → a0 → FreeT f m a Source #

apo ∷ (a0 → Base (FreeT f m a) (Either (FreeT f m a) a0)) → a0 → FreeT f m a Source #

postproRecursive (FreeT f m a) ⇒ (∀ b. Base (FreeT f m a) b → Base (FreeT f m a) b) → (a0 → Base (FreeT f m a) a0) → a0 → FreeT f m a Source #

gpostpro ∷ (Recursive (FreeT f m a), Monad m0) ⇒ (∀ b. m0 (Base (FreeT f m a) b) → Base (FreeT f m a) (m0 b)) → (∀ c. Base (FreeT f m a) c → Base (FreeT f m a) c) → (a0 → Base (FreeT f m a) (m0 a0)) → a0 → FreeT f m a Source #

(Functor m, Functor f) ⇒ Recursive (FreeT f m a) 
Instance details

Defined in Data.Functor.Foldable

Methods

projectFreeT f m a → Base (FreeT f m a) (FreeT f m a) Source #

cata ∷ (Base (FreeT f m a) a0 → a0) → FreeT f m a → a0 Source #

para ∷ (Base (FreeT f m a) (FreeT f m a, a0) → a0) → FreeT f m a → a0 Source #

gpara ∷ (Corecursive (FreeT f m a), Comonad w) ⇒ (∀ b. Base (FreeT f m a) (w b) → w (Base (FreeT f m a) b)) → (Base (FreeT f m a) (EnvT (FreeT f m a) w a0) → a0) → FreeT f m a → a0 Source #

preproCorecursive (FreeT f m a) ⇒ (∀ b. Base (FreeT f m a) b → Base (FreeT f m a) b) → (Base (FreeT f m a) a0 → a0) → FreeT f m a → a0 Source #

gprepro ∷ (Corecursive (FreeT f m a), Comonad w) ⇒ (∀ b. Base (FreeT f m a) (w b) → w (Base (FreeT f m a) b)) → (∀ c. Base (FreeT f m a) c → Base (FreeT f m a) c) → (Base (FreeT f m a) (w a0) → a0) → FreeT f m a → a0 Source #

t ~ FreeT f' m' a' ⇒ Rewrapped (FreeT f m a) t 
Instance details

Defined in Control.Lens.Wrapped

type Zoomed (FreeT f m) 
Instance details

Defined in Control.Lens.Zoom

type Zoomed (FreeT f m) = FocusingFree f m (Zoomed m)
type Unwrapped (FreeT f m a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (FreeT f m a) = m (FreeF f a (FreeT f m a))
type Base (FreeT f m a)

Free transformations of monads are Recursive/Corecursive

Instance details

Defined in Data.Functor.Foldable

type Base (FreeT f m a) = Compose m (FreeF f a)