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