cardano-data-1.2.3.1: Specialized data for Cardano project
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Pulse

Synopsis

The class that defines operations on pulsers.

class Pulsable (pulse ∷ (TypeType) → TypeType) where Source #

let T be a Pulse structure. A Pulse struture is abstracted over a monad: m, and an answer type: t, so the concrete type of a pulse structure is written: (T m a). The Pulsable class supplies operations on the structure that allow its computation to be split into many discrete steps. One does this by running: "pulse p" or "pulseM p", depending upon whether the computation is monadic or not, to run a discrete step. The scheduling infrastructure needs to know nothing about what is going on inside the pulse structure.

Minimal complete definition

done, current, pulseM

Methods

done ∷ pulse m ans → Bool Source #

current ∷ pulse m ans → ans Source #

pulseMMonad m ⇒ pulse m ans → m (pulse m ans) Source #

completeMMonad m ⇒ pulse m ans → m ans Source #

Instances

Instances details
Pulsable PulseListM Source # 
Instance details

Defined in Data.Pulse

Methods

done ∷ ∀ (m ∷ TypeType) ans. PulseListM m ans → Bool Source #

current ∷ ∀ (m ∷ TypeType) ans. PulseListM m ans → ans Source #

pulseMMonad m ⇒ PulseListM m ans → m (PulseListM m ans) Source #

completeMMonad m ⇒ PulseListM m ans → m ans Source #

Pulsable PulseMapM Source # 
Instance details

Defined in Data.Pulse

Methods

done ∷ ∀ (m ∷ TypeType) ans. PulseMapM m ans → Bool Source #

current ∷ ∀ (m ∷ TypeType) ans. PulseMapM m ans → ans Source #

pulseMMonad m ⇒ PulseMapM m ans → m (PulseMapM m ans) Source #

completeMMonad m ⇒ PulseMapM m ans → m ans Source #

Two reusable types that have Pulsable instances

data PulseMapM m ans where Source #

A Map based pulser.

Constructors

PulseMap ∷ !Int → !(ans → k → v → m ans) → !(Map k v) → !ans → PulseMapM m ans 

Instances

Instances details
Pulsable PulseMapM Source # 
Instance details

Defined in Data.Pulse

Methods

done ∷ ∀ (m ∷ TypeType) ans. PulseMapM m ans → Bool Source #

current ∷ ∀ (m ∷ TypeType) ans. PulseMapM m ans → ans Source #

pulseMMonad m ⇒ PulseMapM m ans → m (PulseMapM m ans) Source #

completeMMonad m ⇒ PulseMapM m ans → m ans Source #

Show ans ⇒ Show (PulseMapM m ans) Source # 
Instance details

Defined in Data.Pulse

Methods

showsPrecIntPulseMapM m ans → ShowS Source #

showPulseMapM m ans → String Source #

showList ∷ [PulseMapM m ans] → ShowS Source #

data PulseListM m ans where Source #

A List based pulser

Constructors

PulseList ∷ !Int → !(ans → a → m ans) → ![a] → !ans → PulseListM m ans 

Instances

Instances details
Pulsable PulseListM Source # 
Instance details

Defined in Data.Pulse

Methods

done ∷ ∀ (m ∷ TypeType) ans. PulseListM m ans → Bool Source #

current ∷ ∀ (m ∷ TypeType) ans. PulseListM m ans → ans Source #

pulseMMonad m ⇒ PulseListM m ans → m (PulseListM m ans) Source #

completeMMonad m ⇒ PulseListM m ans → m ans Source #

Show ans ⇒ Show (PulseListM m ans) Source # 
Instance details

Defined in Data.Pulse

Methods

showsPrecIntPulseListM m ans → ShowS Source #

showPulseListM m ans → String Source #

showList ∷ [PulseListM m ans] → ShowS Source #

Virtual versions of PulseMapM and PulseListM specialized to be non-monadic.

type PulseMap ans = PulseListM Identity ans Source #

Type of a Map based pulser in the Identity monad.

type PulseList ans = PulseListM Identity ans Source #

Type of a List based pulser in the Identity monad.

pulseListInt → (t1 → t2 → t1) → [t2] → t1 → PulseListM Identity t1 Source #

Create List pulser structure in the Identity monad, a pure accumulator is lifted to a monadic one.

pulseMapInt → (a → k → v → a) → Map k v → a → PulseMapM Identity a Source #

Create Map pulser structure in the Identity monad, a pure accumulator is lifted to a monadic one.

pulsePulsable p ⇒ p Identity ans → p Identity ans Source #

Pulse a structure in the Identity monad

completePulsable p ⇒ p Identity ans → ans Source #

Complete a structure in the Identity monad

Monadic folds designed to be used inside pulsers.

foldlM' ∷ (Foldable t, Monad m) ⇒ (ans → k → m ans) → ans → t k → m ans Source #

A strict, monadic, version of foldl. It associates to the left.

foldlWithKeyM'Monad m ⇒ (a → k → b → m a) → a → Map k b → m a Source #

O(n). A strict, monadic, version of foldlWithKey. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value. Associates to the left.