-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | the fantastical wizard monoid -- -- A "wizard" can be defined as a program that prompts a user "up front" -- for multiple inputs and then performs several actions after all input -- has been collected. The idea is from Gabriel Gonzalez's blog post, -- http:/www.haskellforall.com201802the-wizard-monoid.html. -- This library provides a WizardT monad transformer, that allows -- users to define wizards over different monads, which becomes similarly -- useful when that monad's Monoid instance lifts the behaviour of -- the underlying Monoid into its own. @package wizard @version 0.1.1 module Wizard -- | A Wizard Monoid, based on ideas expressed by Gabriel Gonzalez -- at http://www.haskellforall.com/2018/02/the-wizard-monoid.html. -- -- One can view this as Compose, specialised to a single functor. newtype WizardT m a WizardT :: m (m a) -> WizardT m a [wand] :: WizardT m a -> m (m a) infixr 9 `WizardT` infixr 9 `WizardT` -- | O(1) fantastical - construct an empty Wizard. egg :: (Applicative f, Monoid a) => WizardT f a -- | O(1) fantastical - construct a singleton Wizard. tadpole :: Applicative f => a -> WizardT f a -- | Map over a Wizard in a fantastical manner. transform :: Functor f => (a -> b) -> WizardT f a -> WizardT f b -- | Get the input (essence) out of the Wizard. essence :: Monad m => WizardT m a -> m a -- | Lift an input into a Wizard. leviosa :: Monad m => m a -> WizardT m a -- | Summon a Wizard out of a monad using a conjuring spell. -- --
--   (>>=) = flip summon . essence
--   
summon :: Monad m => (a -> WizardT m b) -> m a -> WizardT m b -- | Run an action over a collection of inputs fantastically. -- -- This is like 'Beast Mode', but specialised to Wizards. sageMode :: forall m t a b. (Monad m, Foldable t, Monoid a, Monoid b) => (a -> WizardT m b) -> t a -> m b -- | O(1) boring - construct an empty Wizard. empty :: (Applicative f, Monoid a) => WizardT f a -- | O(1) boring - construct a singleton Wizard. singleton :: Applicative f => a -> WizardT f a -- | Map over a Wizard in a boring manner. mapWizard :: Functor f => (a -> b) -> WizardT f a -> WizardT f b -- | Run an action over a collection of inputs. foldWizard :: forall m t a b. (Monad m, Foldable t, Monoid a, Monoid b) => (a -> WizardT m b) -> t a -> m b instance GHC.Base.Functor m => GHC.Generics.Generic1 (Wizard.WizardT m) instance GHC.Generics.Generic (Wizard.WizardT m a) instance GHC.Base.Functor f => GHC.Base.Functor (Wizard.WizardT f) instance GHC.Base.Applicative f => GHC.Base.Applicative (Wizard.WizardT f) instance GHC.Base.Monad m => GHC.Base.Monad (Wizard.WizardT m) instance (GHC.Base.Applicative f, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Wizard.WizardT f a) instance (GHC.Base.Applicative f, GHC.Base.Monoid a) => GHC.Base.Monoid (Wizard.WizardT f a) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Wizard.WizardT f) instance Data.Traversable.Traversable t => Data.Traversable.Traversable (Wizard.WizardT t) instance GHC.Base.Alternative f => GHC.Base.Alternative (Wizard.WizardT f) instance (GHC.Base.Alternative m, GHC.Base.Monad m) => GHC.Base.MonadPlus (Wizard.WizardT m) instance (GHC.Base.Alternative m, GHC.Base.Monad m) => Control.Monad.Fail.MonadFail (Wizard.WizardT m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Wizard.WizardT m) instance Control.Monad.Trans.Class.MonadTrans Wizard.WizardT instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Wizard.WizardT m)