-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Extensible objects -- @package objective @version 0.5.2.1 module Data.Functor.PushPull -- | The type for asynchronous input/output. data PushPull a b r Push :: a -> r -> PushPull a b r Pull :: (b -> r) -> PushPull a b r push :: Elevate (PushPull a b) f => a -> f () pull :: Elevate (PushPull a b) f => f b instance Typeable PushPull instance Functor (PushPull a b) instance Tower (PushPull a b) module Data.Functor.Request -- | 'Request a b' is the type of a request that sends a to -- receive b. data Request a b r Request :: a -> (b -> r) -> Request a b r request :: Elevate (Request a b) f => a -> f b accept :: Functor f => (a -> f b) -> Request a b r -> f r acceptM :: Monad m => (a -> m b) -> Request a b r -> m r instance Typeable Request instance Functor (Request a b) instance Tower (Request a b) -- | Stateful effect transducer: The Mealy machine for effects. module Control.Object -- | The type 'Object e m' represents objects which can handle messages -- e, perform actions in the environment m. It can be -- thought of as an automaton that converts effects. Objects can -- be composed just like functions using .>>.; the identity -- element is echo. newtype Object e m Object :: (forall x. e x -> m (x, Object e m)) -> Object e m runObject :: Object e m -> forall x. e x -> m (x, Object e m) -- | Lift a natural transformation into an object. liftO :: Functor f => (forall x. e x -> f x) -> Object e f -- | Parrots messages given. echo :: Functor e => Object e e -- | Build an object using continuation passing style. oneshot :: (Functor e, Monad m) => (forall a. e (m a) -> m a) -> Object e m -- | Build a stateful object. stateful :: Monad m => (forall a. e a -> StateT s m a) -> s -> Object e m -- | A mutable variable. variable :: Applicative f => s -> Object (State s) f -- | Compose two objects (aka Dependency Injection). (.>>.) :: Functor n => Object e m -> Object m n -> Object e n -- | Change the workspace of the object. transObject :: Functor g => (forall x. f x -> g x) -> Object e f -> Object e g -- | Apply a function to the messages coming into the object. adaptObject :: Functor m => (forall x. e x -> f x) -> Object f m -> Object e m -- | Let object handle sequential methods. sequential :: Monad m => Object e m -> Object (ReifiedProgram e) m runSequential :: Monad m => Object e m -> ReifiedProgram e a -> m (a, Object e m) -- | An object that won't accept any messages. loner :: Functor m => Object Nil m -- | Extend an object by adding another independent object. (.|>.) :: Functor m => Object f m -> Object (Union s) m -> Object (f |> Union s) m -- | Build a stateful object, sharing out the state. sharing :: Monad m => (forall a. e a -> StateT s m a) -> s -> Object (State s |> (e |> Nil)) m -- | The flyweight pattern. flyweight :: Monad m => Ord k => (k -> m a) -> Object (Request k a) m -- | An object which is specialized to be a Mealy machine newtype Process m a b Process :: Object (Request a b) m -> Process m a b unProcess :: Process m a b -> Object (Request a b) m -- |
-- _Process :: Iso' (Object (Request a b) m) (Process m a b) --_Process :: (Profunctor p, Functor f) => p (Process m a b) (f (Process m a b)) -> (p (Object (Request a b) m) (f (Object (Request a b) m))) instance Typeable Object instance (Applicative m, Fractional o) => Fractional (Process m i o) instance (Applicative m, Num o) => Num (Process m i o) instance Monad m => Choice (Process m) instance Monad m => Strong (Process m) instance Monad m => Profunctor (Process m) instance Monad m => ArrowChoice (Process m) instance Monad m => Arrow (Process m) instance Monad m => Category (Process m) instance (Applicative f, Monoid b) => Monoid (Process f a b) instance Applicative f => Applicative (Process f a) instance Functor f => Functor (Process f a) -- | MonadObjective class and operations module Control.Monad.Objective.Class type Instance' e m = Instance e m m class (Tower m, Monad m) => MonadObjective m where data family Instance (e :: * -> *) (n :: * -> *) m invoke :: (MonadObjective m, Monad n) => Instance e n m -> e a -> m (n (m a)) new :: MonadObjective m => Object e n -> m (Instance e n m) -- | Invoke a method. (.-) :: (Monad n, Elevate n m, MonadObjective m, Elevate m f) => Instance e n m -> e a -> f a -- | Similar to '(.-)', but also lifts the method according to the -- instance. (.^) :: (Elevate e f, Monad n, Elevate n m, MonadObjective m, Elevate m g) => Instance f n m -> e a -> g a -- | Specialized (.^) for StateT (.&) :: (MonadObjective m, Elevate (StateT s m) e, Monad n, Elevate n m, Elevate m f) => Instance e n m -> StateT s m a -> f a -- | MonadObjective IO using MVar module Control.Monad.Objective.IO instance MonadObjective IO -- | MonadObjective ST using STRef module Control.Monad.Objective.ST instance MonadObjective (ST s) module Control.Monad.Objective