-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Monads of program skeleta
--   
--   Fast operational monad library
@package monad-skeleton
@version 0.1.5

module Control.Monad.Skeleton.Internal
data Cat k a b
[Leaf] :: k a b -> Cat k a b
[Tree] :: Cat k a b -> Cat k b c -> Cat k a c
transCat :: (forall x y. j x y -> k x y) -> Cat j a b -> Cat k a b
(|>) :: Cat k a b -> k b c -> Cat k a c
viewL :: forall k a b r. Cat k a b -> (k a b -> r) -> (forall x. k a x -> Cat k x b -> r) -> r
transKleisli :: (m b -> n b) -> Kleisli m a b -> Kleisli n a b

module Control.Monad.Skeleton

-- | A deconstructed action
data MonadView t m x
[Return] :: a -> MonadView t m a
[:>>=] :: !(t a) -> (a -> m b) -> MonadView t m b

-- | Transform the action and the continuation.
hoistMV :: (forall x. s x -> t x) -> (m a -> n a) -> MonadView s m a -> MonadView t n a

-- | Join <a>MonadView</a> recursively.
iterMV :: Monad m => (t a -> MonadView m t a) -> t a -> m a

-- | <tt><a>Skeleton</a> t</tt> is a monadic skeleton (operational monad)
--   made out of <tt>t</tt>. Skeletons can be fleshed out by getting
--   transformed to other monads. It provides O(1) (<a>&gt;&gt;=</a>) and
--   <a>debone</a>, the monadic reflection.
data Skeleton t a
[ReturnS] :: a -> Skeleton t a
[BindS] :: t a -> Cat (Kleisli (Skeleton t)) a b -> Skeleton t b

-- | A skeleton that has only one bone.
bone :: t a -> Skeleton t a

-- | Pick a bone from a <a>Skeleton</a>.
debone :: Skeleton t a -> MonadView t (Skeleton t) a

-- | Pick a bone from a <a>Skeleton</a> by a function. It's useful when
--   used with <tt>LambdaCase</tt>.
--   
--   Usecase:
--   
--   <pre>
--   interpretM :: Monad m =&gt; Skeleton m a -&gt; m a
--   interpretM = deboneBy $ \case
--     Return a -&gt; return a
--     x :&gt;&gt;= f -&gt; x &gt;&gt;= interpretM . f
--   </pre>
deboneBy :: (MonadView t (Skeleton t) a -> r) -> Skeleton t a -> r

-- | Uncommon synonym for <a>debone</a>.

-- | <i>Deprecated: Use debone instead</i>
unbone :: Skeleton t a -> MonadView t (Skeleton t) a

-- | Re-add a bone.
boned :: MonadView t (Skeleton t) a -> Skeleton t a

-- | Lift a transformation between bones into transformation between
--   skeletons.
hoistSkeleton :: forall s t a. (forall x. s x -> t x) -> Skeleton s a -> Skeleton t a
instance GHC.Base.Functor (Control.Monad.Skeleton.Skeleton t)
instance GHC.Base.Applicative (Control.Monad.Skeleton.Skeleton t)
instance GHC.Base.Monad (Control.Monad.Skeleton.Skeleton t)
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Skeleton.MonadView t m)

module Control.Monad.Zombie

-- | <a>Zombie</a> is a variant of <a>Skeleton</a> which has an
--   <a>Alternative</a> instance.
data Zombie t a
[Sunlight] :: Zombie t a
[ReturnZ] :: a -> Zombie t a -> Zombie t a
[BindZ] :: t x -> Cat (Kleisli (Zombie t)) x a -> Zombie t a -> Zombie t a

-- | Lift a unit action
liftZ :: t a -> Zombie t a

-- | Turn a decomposed form into a composed form.
embalm :: MonadView t (Zombie t) a -> Zombie t a

-- | Decompose a zombie as a list of possibilities.
disembalm :: Zombie t a -> [MonadView t (Zombie t) a]

-- | Like <a>hoistSkeleton</a>
hoistZombie :: forall s t a. (forall x. s x -> t x) -> Zombie s a -> Zombie t a
instance GHC.Base.Functor (Control.Monad.Zombie.Zombie t)
instance GHC.Base.Applicative (Control.Monad.Zombie.Zombie t)
instance GHC.Base.Alternative (Control.Monad.Zombie.Zombie t)
instance GHC.Base.Monad (Control.Monad.Zombie.Zombie t)
instance GHC.Base.MonadPlus (Control.Monad.Zombie.Zombie t)
