| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
UntypedPlutusCore.Evaluation.Machine.Cek.StepCounter
Synopsis
- newtype StepCounter (n :: MutablePrimArray s Word8)
- newCounter :: (KnownNat n, PrimMonad m) => Proxy n -> m (StepCounter n (PrimState m))
- resetCounter :: forall n m. (KnownNat n, PrimMonad m) => StepCounter n (PrimState m) -> m ()
- readCounter :: forall m n. PrimMonad m => StepCounter n (PrimState m) -> Int -> m Word8
- writeCounter :: forall m n. PrimMonad m => StepCounter n (PrimState m) -> Int -> Word8 -> m ()
- modifyCounter :: PrimMonad m => Int -> (Word8 -> Word8) -> StepCounter n (PrimState m) -> m Word8
- itraverseCounter_ :: forall n m. (UpwardsM m (NatToPeano n), PrimMonad m) => (Int -> Word8 -> m ()) -> StepCounter n (PrimState m) -> m ()
- iforCounter_ :: (UpwardsM m (NatToPeano n), PrimMonad m) => StepCounter n (PrimState m) -> (Int -> Word8 -> m ()) -> m ()
Documentation
newtype StepCounter (n :: Nat) s #
A set of Word8 counters that is used in the CEK machine
to count steps.
Constructors
| StepCounter (MutablePrimArray s Word8) |
newCounter :: (KnownNat n, PrimMonad m) => Proxy n -> m (StepCounter n (PrimState m)) #
Make a new StepCounter with the given number of counters.
resetCounter :: forall n m. (KnownNat n, PrimMonad m) => StepCounter n (PrimState m) -> m () #
Reset all the counters in the given StepCounter to zero.
readCounter :: forall m n. PrimMonad m => StepCounter n (PrimState m) -> Int -> m Word8 #
Read the value of a counter.
writeCounter :: forall m n. PrimMonad m => StepCounter n (PrimState m) -> Int -> Word8 -> m () #
Write to a counter.
modifyCounter :: PrimMonad m => Int -> (Word8 -> Word8) -> StepCounter n (PrimState m) -> m Word8 #
Modify the value of a counter. Returns the modified value.
itraverseCounter_ :: forall n m. (UpwardsM m (NatToPeano n), PrimMonad m) => (Int -> Word8 -> m ()) -> StepCounter n (PrimState m) -> m () #
Traverse the counters with an effectful function.
iforCounter_ :: (UpwardsM m (NatToPeano n), PrimMonad m) => StepCounter n (PrimState m) -> (Int -> Word8 -> m ()) -> m () #
Traverse the counters with an effectful function.