Safe Haskell | None |
---|---|
Language | Haskell2010 |
Wizard
Synopsis
- newtype WizardT m a = WizardT {
- wand :: m (m a)
- egg :: (Applicative f, Monoid a) => WizardT f a
- tadpole :: Applicative f => a -> WizardT f a
- transform :: Functor f => (a -> b) -> WizardT f a -> WizardT f b
- essence :: Monad m => WizardT m a -> m a
- leviosa :: Monad m => m a -> WizardT m a
- summon :: Monad m => (a -> WizardT m b) -> m a -> WizardT m b
- sageMode :: forall m t a b. (Monad m, Foldable t, Monoid a, Monoid b) => (a -> WizardT m b) -> t a -> m b
- empty :: (Applicative f, Monoid a) => WizardT f a
- singleton :: Applicative f => a -> WizardT f a
- mapWizard :: Functor f => (a -> b) -> WizardT f a -> WizardT f b
- foldWizard :: forall m t a b. (Monad m, Foldable t, Monoid a, Monoid b) => (a -> WizardT m b) -> t a -> m b
Documentation
newtype WizardT m a infixr 9 Source #
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.
Instances
Fantastical use of a Wizard
egg :: (Applicative f, Monoid a) => WizardT f a Source #
O(1) fantastical - construct an empty Wizard.
tadpole :: Applicative f => a -> WizardT f a Source #
O(1) fantastical - construct a singleton Wizard.
transform :: Functor f => (a -> b) -> WizardT f a -> WizardT f b Source #
Map over a Wizard in a fantastical manner.
sageMode :: forall m t a b. (Monad m, Foldable t, Monoid a, Monoid b) => (a -> WizardT m b) -> t a -> m b Source #
Run an action over a collection of inputs fantastically.
This is like 'Beast Mode', but specialised
to Wizard
s.
Boring use of a Wizard
singleton :: Applicative f => a -> WizardT f a Source #
O(1) boring - construct a singleton Wizard.