cardano-data-1.3.2.0: Specialized data for Cardano project
Safe HaskellNone
LanguageHaskell2010

Data.Pulse

Synopsis

The class that defines operations on pulsers.

class Pulsable (pulse ∷ (Type → Type) → Type → Type) 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 ∷ ∀ (m ∷ Type → Type) ans. pulse m ans → Bool Source #

current ∷ ∀ (m ∷ Type → Type) ans. pulse m ans → ans Source #

pulseM ∷ Monad m ⇒ pulse m ans → m (pulse m ans) Source #

completeM ∷ Monad m ⇒ pulse m ans → m ans Source #

Instances

Instances details
Pulsable PulseListM Source # 
Instance details

Defined in Data.Pulse

Methods

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

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

pulseM ∷ Monad m ⇒ PulseListM m ans → m (PulseListM m ans) Source #

completeM ∷ Monad m ⇒ PulseListM m ans → m ans Source #

Pulsable PulseMapM Source # 
Instance details

Defined in Data.Pulse

Methods

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

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

pulseM ∷ Monad m ⇒ PulseMapM m ans → m (PulseMapM m ans) Source #

completeM ∷ Monad m ⇒ PulseMapM m ans → m ans Source #

Two reusable types that have Pulsable instances

data PulseMapM (m ∷ Type → Type) ans where Source #

A Map based pulser.

Constructors

PulseMap ∷ ∀ ans k v (m ∷ Type → Type). !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 ∷ Type → Type) ans. PulseMapM m ans → Bool Source #

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

pulseM ∷ Monad m ⇒ PulseMapM m ans → m (PulseMapM m ans) Source #

completeM ∷ Monad m ⇒ PulseMapM m ans → m ans Source #

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

Defined in Data.Pulse

Methods

showsPrec ∷ Int → PulseMapM m ans → ShowS #

show ∷ PulseMapM m ans → String #

showList ∷ [PulseMapM m ans] → ShowS #

data PulseListM (m ∷ Type → Type) ans where Source #

A List based pulser

Constructors

PulseList ∷ ∀ ans a (m ∷ Type → Type). !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 ∷ Type → Type) ans. PulseListM m ans → Bool Source #

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

pulseM ∷ Monad m ⇒ PulseListM m ans → m (PulseListM m ans) Source #

completeM ∷ Monad m ⇒ PulseListM m ans → m ans Source #

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

Defined in Data.Pulse

Methods

showsPrec ∷ Int → PulseListM m ans → ShowS #

show ∷ PulseListM m ans → String #

showList ∷ [PulseListM m ans] → ShowS #

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.

pulseList ∷ Int → (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.

pulseMap ∷ Int → (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.

pulse ∷ Pulsable p ⇒ p Identity ans → p Identity ans Source #

Pulse a structure in the Identity monad

complete ∷ Pulsable 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.