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


-- | van Laarhoven encoded Free Monad with Extensible Effects
--   
--   The van Laarhoven encoding of Free Monads, both the original and with
--   extensible effects.
--   
--   For more information on the van Laarhoven Free Monads, including
--   examples, please see the following blog posts:
--   
--   Initial formulation by Russell O'Connor:
--   <a>http://r6.ca/blog/20140210T181244Z.html</a>
--   
--   Adding Extensible Effects by Aaron Levin:
--   <a>http://aaronlevin.ca/post/136494428283/extensible-effects-in-the-van-laarhoven-free-monad</a>
@package free-vl
@version 0.1.4


-- | "van Laarhoven encoded Free Monad"
module Control.Monad.Free.VanLaarhoven

-- | The van Laarhoven-encoded Free Monad
newtype Free effect a
Free :: forall m. Monad m => effect m -> m a -> Free effect a
[runFree] :: Free effect a -> forall m. Monad m => effect m -> m a
instance GHC.Base.Functor (Control.Monad.Free.VanLaarhoven.Free effect)
instance GHC.Base.Applicative (Control.Monad.Free.VanLaarhoven.Free effect)
instance GHC.Base.Monad (Control.Monad.Free.VanLaarhoven.Free effect)


-- | "van Laarhoven encoded Free Monad with extensible effects"
module Control.Monad.Free.VanLaarhovenE

-- | Helper combinator for creating values of 'Effects effects m'
(.:.) :: effect m -> Effects effects m -> Effects (effect : effects) m
infixr 4 .:.

-- | a customized HList of effects. We need to carry the <tt>m</tt> param
--   around for type inference.
data Effects a (m :: * -> *)
[EmptyE] :: Effects '[] m
[ConsE] :: effect m -> Effects effects m -> Effects (effect : effects) m

-- | The van Laarhoven-encoded Free Monad with Extensible effects
newtype Free effects a
Free :: forall m. Monad m => Effects effects m -> m a -> Free effects a
[runFree] :: Free effects a -> forall m. Monad m => Effects effects m -> m a

-- | A class to help us fetch effects from our effect stack.
class HasEffect (effects :: [((* -> *) -> *)]) (effect :: ((* -> *) -> *))
getEffect :: HasEffect effects effect => Effects effects m -> effect m

-- | Tear down a <a>Free</a> <a>Monad</a> using the supplied effects value.
iterM :: Monad m => Effects effects m -> Free effects a -> m a

-- | A version of lift that can be used with an effect stack.
liftF :: HasEffect effects effect => (forall m. Monad m => effect m -> m a) -> Free effects a
instance Control.Monad.Free.VanLaarhovenE.HasEffect effects effect => Control.Monad.Free.VanLaarhovenE.HasEffect (notIt : effects) effect
instance Control.Monad.Free.VanLaarhovenE.HasEffect (effect : effects) effect
instance GHC.Base.Functor (Control.Monad.Free.VanLaarhovenE.Free effect)
instance GHC.Base.Applicative (Control.Monad.Free.VanLaarhovenE.Free effect)
instance GHC.Base.Monad (Control.Monad.Free.VanLaarhovenE.Free effect)
