box-0.2.0: boxes

Safe HaskellNone
LanguageHaskell2010

Box.Box

Description

A box is something that commits and emits

Synopsis

Documentation

data Box m c e Source #

A Box is a product of a Committer m and an Emitter. Think of a box with an incoming wire and an outgoing wire. Now notice that the abstraction is reversable: are you looking at two wires from "inside a box"; a blind erlang grunt communicating with the outside world via the two thin wires, or are you looking from "outside the box"; interacting with a black box object. Either way, it's a box. And either way, the committer is contravariant and the emitter covariant so it forms a profunctor.

a Box can also be seen as having an input tape and output tape, thus available for turing and finite-state machine metaphorics.

Constructors

Box 

Fields

Instances
Functor m => Profunctor (Box m) Source # 
Instance details

Defined in Box.Box

Methods

dimap :: (a -> b) -> (c -> d) -> Box m b c -> Box m a d #

lmap :: (a -> b) -> Box m b c -> Box m a c #

rmap :: (b -> c) -> Box m a b -> Box m a c #

(#.) :: Coercible c b => q b c -> Box m a b -> Box m a c #

(.#) :: Coercible b a => Box m b c -> q a b -> Box m a c #

(Alternative m, Monad m) => Semigroup (Box m c e) Source # 
Instance details

Defined in Box.Box

Methods

(<>) :: Box m c e -> Box m c e -> Box m c e #

sconcat :: NonEmpty (Box m c e) -> Box m c e #

stimes :: Integral b => b -> Box m c e -> Box m c e #

(Alternative m, Monad m) => Monoid (Box m c e) Source # 
Instance details

Defined in Box.Box

Methods

mempty :: Box m c e #

mappend :: Box m c e -> Box m c e -> Box m c e #

mconcat :: [Box m c e] -> Box m c e #

liftB :: MonadConc m => Box (STM m) a b -> Box m a b Source #

lift a box from STM

bmap :: Monad m => (a' -> m (Maybe a)) -> (b -> m (Maybe b')) -> Box m a b -> Box m a' b' Source #

a profunctor dimapMaybe