Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Pulsable (pulse :: ( Type -> Type ) -> Type -> Type ) where
- data PulseMapM m ans where
-
data
PulseListM
m ans
where
- PulseList :: ! Int -> !(ans -> a -> m ans) -> ![a] -> !ans -> PulseListM m ans
- type PulseMap ans = PulseListM Identity ans
- type PulseList ans = PulseListM Identity ans
- pulseList :: Int -> (t1 -> t2 -> t1) -> [t2] -> t1 -> PulseListM Identity t1
- pulseMap :: Int -> (a -> k -> v -> a) -> Map k v -> a -> PulseMapM Identity a
- pulse :: Pulsable p => p Identity ans -> p Identity ans
- complete :: Pulsable p => p Identity ans -> ans
- foldlM' :: ( Foldable t, Monad m) => (ans -> k -> m ans) -> ans -> t k -> m ans
- foldlWithKeyM' :: Monad m => (a -> k -> b -> m a) -> a -> Map k b -> m a
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.
done :: pulse m ans -> Bool Source #
current :: pulse m ans -> ans Source #
pulseM :: Monad m => pulse m ans -> m (pulse m ans) Source #
Instances
Pulsable PulseMapM Source # | |
Pulsable PulseListM Source # | |
Defined in Data.Pulse done :: forall (m :: Type -> Type ) ans. PulseListM m ans -> Bool Source # current :: forall (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 # |
Two reusable types that have Pulsable instances
data PulseMapM m ans where Source #
A Map based pulser.
data PulseListM m ans where Source #
A List based pulser
PulseList :: ! Int -> !(ans -> a -> m ans) -> ![a] -> !ans -> PulseListM m ans |
Instances
Pulsable PulseListM Source # | |
Defined in Data.Pulse done :: forall (m :: Type -> Type ) ans. PulseListM m ans -> Bool Source # current :: forall (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 # | |
Defined in Data.Pulse |
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
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.