| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver
Synopsis
- class Breakpointable ann bps | ann → bps where
- hasBreakpoints ∷ ann → bps → Bool
- data CekState uni fun ann
- data Cmd bps
- runDriverT ∷ ∀ uni fun ann bps m. (Breakpointable ann bps, MonadFree (DebugF uni fun ann bps) m) ⇒ NTerm uni fun ann → m ()
- data DebugF uni fun ann bps a
- = InputF (Cmd bps → a)
- | DriverLogF Text a
- | StepF (CekState uni fun ann) (CekState uni fun ann → a)
- | UpdateClientF (CekState uni fun ann) a
- 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)
- type CekTrans uni fun ann s = Trans (CekM uni fun s) (CekState uni fun ann)
- class Monad m ⇒ MonadFree (f ∷ Type → Type) (m ∷ Type → Type) | m → f
- iterM ∷ (Functor f, Monad m) ⇒ (f (m a) → m a) → Free f a → m a
- iterTM ∷ ∀ f (m ∷ Type → Type) 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
- partialIterT ∷ Monad m ⇒ Integer → (∀ a. f a → m a) → FreeT f m b → FreeT f m b
- cutoff ∷ ∀ (f ∷ Type → Type) (m ∷ Type → Type) a. (Functor f, Monad m) ⇒ Integer → FreeT f m a → FreeT f m (Maybe a)
- data FreeT (f ∷ Type → Type) (m ∷ Type → Type) a
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 #
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 |
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]. |
| UpdateClientF (CekState uni fun ann) a | |
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.
class Monad m ⇒ MonadFree (f ∷ Type → Type) (m ∷ Type → Type) | m → f Source #
Monads provide substitution (fmap) and renormalization (join):
m>>=f =join(fmapf 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 smashes the lists flat.join [[a]]
On the other hand, consider:
data Tree a = Bin (Tree a) (Tree a) | Tip a
instanceMonadTree wherereturn= 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:
instanceMonadFreePair Tree wherewrap(Pair l r) = Bin l r
Or we could choose to program with instead of Free PairTree
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
| Functor f ⇒ MonadFree f (Free f) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (Yoneda m) | |
Defined in Data.Functor.Yoneda | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (MaybeT m) | |
| (Functor f, Monad m) ⇒ MonadFree f (FreeT f m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (ExceptT e m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (IdentityT m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (ReaderT e m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (StateT s m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (StateT s m) | |
| (Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (WriterT w m) | |
| (Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (WriterT w m) | |
| (Functor f, MonadFree f m) ⇒ MonadFree f (ContT r m) | |
| (Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (RWST r w s m) | |
| (Functor f, MonadFree f m, Monoid w) ⇒ MonadFree f (RWST r w s m) | |
iterM ∷ (Functor f, Monad m) ⇒ (f (m a) → m a) → Free f a → m a Source #
Like iter for monadic values.
iterTM ∷ ∀ f (m ∷ Type → Type) 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.
partialIterT ∷ Monad 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):
partialIterT0 _ m ≡ mpartialIterT(n+1) phi.return≡returnpartialIterT(n+1) phi.lift≡liftpartialIterT(n+1) phi.wrap≡join.lift. phi
cutoff ∷ ∀ (f ∷ Type → Type) (m ∷ Type → Type) a. (Functor f, Monad m) ⇒ Integer → FreeT 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):
cutoff0 _ ≡returnNothingcutoff(n+1).return≡return.Justcutoff(n+1).lift≡lift.liftMJustcutoff(n+1).wrap≡wrap.fmap(cutoffn)
Calling is always terminating, provided each of the
steps in the iteration is terminating.retract . cutoff n
data FreeT (f ∷ Type → Type) (m ∷ Type → Type) a Source #
The "free monad transformer" for a functor f
Instances
| (Functor f, Monad m) ⇒ MonadFree f (FreeT f m) | |
| (Functor f, MonadError e m) ⇒ MonadError e (FreeT f m) | |
Defined in Control.Monad.Trans.Free Methods throwError ∷ e → FreeT f m a Source # catchError ∷ FreeT f m a → (e → FreeT f m a) → FreeT f m a Source # | |
| (Functor f, MonadReader r m) ⇒ MonadReader r (FreeT f m) | |
| (Functor f, MonadState s m) ⇒ MonadState s (FreeT f m) | |
| (Functor f, MonadWriter w m) ⇒ MonadWriter w (FreeT f m) | |
| (Functor f, MonadBase b m) ⇒ MonadBase b (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| Functor f ⇒ MonadTrans (FreeT f) | |
| (Functor f, MonadFail m) ⇒ MonadFail (FreeT f m) | |
| (Functor f, MonadIO m) ⇒ MonadIO (FreeT f m) | |
| (Foldable m, Foldable f) ⇒ Foldable (FreeT f m) | |
Defined in Control.Monad.Trans.Free Methods fold ∷ Monoid m0 ⇒ FreeT f m m0 → m0 Source # foldMap ∷ Monoid 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 # toList ∷ FreeT f m a → [a] Source # null ∷ FreeT f m a → Bool Source # length ∷ FreeT f m a → Int Source # elem ∷ Eq a ⇒ a → FreeT f m a → Bool Source # maximum ∷ Ord a ⇒ FreeT f m a → a Source # minimum ∷ Ord a ⇒ FreeT f m a → a Source # | |
| (Eq1 f, Eq1 m) ⇒ Eq1 (FreeT f m) | |
| (Ord1 f, Ord1 m) ⇒ Ord1 (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Read1 f, Read1 m) ⇒ Read1 (FreeT f m) | |
Defined in Control.Monad.Trans.Free Methods liftReadsPrec ∷ (Int → ReadS a) → ReadS [a] → Int → ReadS (FreeT f m a) Source # liftReadList ∷ (Int → ReadS a) → ReadS [a] → ReadS [FreeT f m a] Source # liftReadPrec ∷ ReadPrec a → ReadPrec [a] → ReadPrec (FreeT f m a) Source # liftReadListPrec ∷ ReadPrec a → ReadPrec [a] → ReadPrec [FreeT f m a] Source # | |
| (Show1 f, Show1 m) ⇒ Show1 (FreeT f m) | |
| (Monad m, Traversable m, Traversable f) ⇒ Traversable (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Functor f, MonadPlus m) ⇒ Alternative (FreeT f m) | |
| (Functor f, Monad m) ⇒ Applicative (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Functor f, Functor m) ⇒ Functor (FreeT f m) | |
| (Functor f, Monad m) ⇒ Monad (FreeT f m) | |
| (Functor f, MonadPlus m) ⇒ MonadPlus (FreeT f m) | |
| (Functor f, MonadCatch m) ⇒ MonadCatch (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Functor f, MonadThrow m) ⇒ MonadThrow (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Functor f, MonadCont m) ⇒ MonadCont (FreeT f m) | |
| (Functor f, Monad m) ⇒ Apply (FreeT f m) | |
| (Functor f, Monad m) ⇒ Bind (FreeT f m) | |
| (Functor f, Zoom m n s t) ⇒ Zoom (FreeT f m) (FreeT f n) s t | |
Defined in Control.Lens.Zoom | |
| (Read1 f, Read1 m, Read a) ⇒ Read (FreeT f m a) | |
| (Show1 f, Show1 m, Show a) ⇒ Show (FreeT f m a) | |
| (Eq1 f, Eq1 m, Eq a) ⇒ Eq (FreeT f m a) | |
| (Ord1 f, Ord1 m, Ord a) ⇒ Ord (FreeT f m a) | |
Defined in Control.Monad.Trans.Free Methods compare ∷ FreeT 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 # | |
| (Traversable f, Traversable m) ⇒ Plated (FreeT f m a) | |
Defined in Control.Lens.Plated | |
| Wrapped (FreeT f m a) | |
Defined in Control.Lens.Wrapped Associated Types type Unwrapped (FreeT f m a) | |
| (Functor m, Functor f) ⇒ Corecursive (FreeT f m a) | |
Defined in Data.Functor.Foldable Methods embed ∷ Base (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 # postpro ∷ Recursive (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) | |
Defined in Data.Functor.Foldable Methods project ∷ FreeT 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 # prepro ∷ Corecursive (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 | |
Defined in Control.Lens.Wrapped | |
| type Zoomed (FreeT f m) | |
Defined in Control.Lens.Zoom type Zoomed (FreeT f m) = FocusingFree f m (Zoomed m) | |
| type Unwrapped (FreeT f m a) | |
Defined in Control.Lens.Wrapped | |
| type Base (FreeT f m a) | Free transformations of monads are Recursive/Corecursive |
Defined in Data.Functor.Foldable | |