wren-extras-2011.7.13: wren ng thornton's random collection of extras

Portabilityportable
Stabilityexperimental
Maintainerwren@community.haskell.org

Prelude.Extras

Description

This module provides additional primitive utilities I often want. They're so simple I'm surprised the Prelude lacks them, and they're too trivial to put anywhere else.

See also Control.Monad.Extras, Control.Exception.Extras, Data.ByteString.Char8.Extras.

Synopsis

Documentation

swap :: (a, b) -> (b, a)Source

Swap the order of a tuple pair. This is provided by Data.Tuple as of base-4.3.0.0

class Monad m => MonadPlus m where

Monads that also support choice and failure.

Methods

mzero :: m a

the identity of mplus. It should also satisfy the equations

mzero >>= f = mzero v >> mzero = mzero

(but the instance for System.IO.IO defined in Control.Monad.Error in the mtl package does not satisfy the second one).

mplus :: m a -> m a -> m a

an associative operation

Instances

liftM :: Monad m => (a1 -> r) -> m a1 -> m r

Promote a function to a monad.