cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.MockChain.Misc

Description

This module defines primitives that offer quality of life features when operating a mockchain without interacting with the mockchain state itself.

Synopsis

Misc effect

data MockChainMisc :: Effect where Source #

An effect that corresponds to extra QOL capabilities of the MockChain

Constructors

Define :: ToHash a => String -> a -> MockChainMisc m a 
Note :: (PrettyCookedOpts -> DocCooked) -> MockChainMisc m () 
Assert :: String -> Bool -> MockChainMisc m () 

runMockChainMisc :: forall effs a j. Member (Writer j) effs => (String -> BuiltinByteString -> j) -> ((PrettyCookedOpts -> DocCooked) -> j) -> (String -> Bool -> j) -> Sem (MockChainMisc : effs) a -> Sem effs a Source #

Interpreting a MockChainMisc in terms of a writer of Map BuiltinByteString String

Storing aliases for hashable elements

define :: forall effs a. (Member MockChainMisc effs, ToHash a) => String -> a -> Sem effs a Source #

Stores an alias matching a hashable data for pretty printing purpose

defineM :: (Member MockChainMisc effs, ToHash a) => String -> Sem effs a -> Sem effs a Source #

Like define, but binds the result of a monadic computation instead

Taking notes in the notebook

note :: forall effs. Member MockChainMisc effs => (PrettyCookedOpts -> DocCooked) -> Sem effs () Source #

Takes note of an element represented as its rendering function to trace at the end of the run

noteP :: forall effs s. (Member MockChainMisc effs, PrettyCooked s) => s -> Sem effs () Source #

Takes note of a pretty-printable element to trace at the end of the run

noteL :: forall effs l. (Member MockChainMisc effs, PrettyCookedList l) => String -> l -> Sem effs () Source #

Takes note of a pretty-printable element as list with a title, to trace at the end of the run

noteW :: forall effs s. (Member MockChainMisc effs, Show s) => s -> Sem effs () Source #

Takes note of a showable element to trace at the end of the run

noteS :: forall effs. Member MockChainMisc effs => String -> Sem effs () Source #

Takes note of a String to trace at the end of the run

Asserting properties

assert :: forall effs. Member MockChainMisc effs => String -> Bool -> Sem effs () Source #

Ensures a specific property holds, sending the provided error message otherwise

assert' :: forall effs. Member MockChainMisc effs => Bool -> Sem effs () Source #

Ensures a specific property holds, with a default error message otherwise