| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
Control.Object.Object
- newtype Object f g = Object {}
- (@-) :: Object f g -> f x -> g (x, Object f g)
- class HProfunctor k where
- echo :: Functor f => Object f f
- liftO :: Functor g => (forall x. f x -> g x) -> Object f g
- (@>>@) :: Functor h => Object f g -> Object g h -> Object f h
- (@<<@) :: Functor h => Object g h -> Object f g -> Object f h
- unfoldO :: Functor g => (forall a. r -> f a -> g (a, r)) -> r -> Object f g
- unfoldOM :: Monad m => (forall a. r -> f a -> m (a, r)) -> r -> Object f m
- stateful :: Monad m => (forall a. f a -> StateT s m a) -> s -> Object f m
- iterObject :: Monad m => Object f m -> Free f a -> m (a, Object f m)
- iterative :: Monad m => Object f m -> Object (Free f) m
- variable :: Monad m => s -> Object (StateT s m) m
- announce :: (Traversable t, Monad m) => f a -> StateT (t (Object f m)) m [a]
Documentation
The type Object f g represents objects which can handle messages f, perform actions in the environment g.
It can be thought of as an automaton that converts effects.
Objects can be composed just like functions using @>>@; the identity element is echo.
Objects are morphisms of the category of actions.
- Naturality
runObject obj . fmap f ≡ fmap f . runObject obj
Instances
| HProfunctor Object | |
| Typeable ((* -> *) -> (* -> *) -> *) Object |
class HProfunctor k where Source
Methods
(^>>@) :: Functor h => (forall x. f x -> g x) -> k g h -> k f h infixr 1 Source
(@>>^) :: Functor h => k f g -> (forall x. g x -> h x) -> k f h infixr 1 Source
Instances
liftO :: Functor g => (forall x. f x -> g x) -> Object f g Source
Lift natural transformation into an object
unfoldO :: Functor g => (forall a. r -> f a -> g (a, r)) -> r -> Object f g Source
The unwrapped analog of stateful
unfoldO runObject = id
unfoldO iterObject = iterable