Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- hashOpenTerm :: Term s a -> TermCont s Dig
- newtype TermCont :: forall (r :: PType). S -> Type -> Type where
- $sel:runTermCont:TermCont :: TermCont @r s a -> (a -> Term s r) -> Term s r
- unTermCont :: TermCont @a s (Term s a) -> Term s a
- tcont :: ((a -> Term s r) -> Term s r) -> TermCont @r s a
- pletC :: Term s a -> TermCont s (Term s a)
- pmatchC :: PlutusType a => Term s a -> TermCont s (a s)
- pletFieldsC :: forall fs a s b ps bs. (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> TermCont @b s (HRec (BoundTerms ps bs s))
- ptraceC :: Term s PString -> TermCont s ()
- pguardC :: Term s PString -> Term s PBool -> TermCont s ()
- pguardC' :: Term s a -> Term s PBool -> TermCont @a s ()
- ptryFromC :: forall b r a s. PTryFrom a b => Term s a -> TermCont @r s (Term s b, Reduce (PTryFromExcess a b s))
- pexpectJustC :: forall (a :: S -> Type) (r :: S -> Type) (s :: S). Term s r -> Term s (PMaybe a) -> TermCont @r s (Term s a)
Documentation
newtype TermCont :: forall (r :: PType). S -> Type -> Type where Source #
Instances
MonadFail (TermCont s) Source # | |
Applicative (TermCont s) Source # | |
Defined in Plutarch.Internal.TermCont pure :: a -> TermCont s a Source # (<*>) :: TermCont s (a -> b) -> TermCont s a -> TermCont s b Source # liftA2 :: (a -> b -> c) -> TermCont s a -> TermCont s b -> TermCont s c Source # (*>) :: TermCont s a -> TermCont s b -> TermCont s b Source # (<*) :: TermCont s a -> TermCont s b -> TermCont s a Source # | |
Functor (TermCont s) Source # | |
Monad (TermCont s) Source # | |
pletFieldsC :: forall fs a s b ps bs. (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> TermCont @b s (HRec (BoundTerms ps bs s)) Source #
Like pletFields
but works in a TermCont
monad.
ptraceC :: Term s PString -> TermCont s () Source #
Like ptrace
but works in a TermCont
monad.
Example ===
foo :: Term s PUnit foo = unTermCont $ do ptraceC "returning unit!" pure $ pconstant ()
pguardC :: Term s PString -> Term s PBool -> TermCont s () Source #
Trace a message and raise error if cond
is false. Otherwise, continue.
Example ===
onlyAllow42 :: Term s (PInteger :--> PUnit) onlyAllow42 = plam $ i -> unTermCont $ do pguardC "expected 42" $ i #== 42 pure $ pconstant ()
pguardC' :: Term s a -> Term s PBool -> TermCont @a s () Source #
Stop computation and return given term if cond
is false. Otherwise, continue.
Example ===
is42 :: Term s (PInteger :--> PBool) is42 = plam $ i -> unTermCont $ do pguardC' (pconstant False) $ i #== 42 pure $ pconstant True