{-# OPTIONS_GHC -Wall -fwarn-tabs #-} ---------------------------------------------------------------- -- ~ 2010.11.15 -- | -- Module : Prelude.Extras -- Copyright : Copyright (c) 2007--2009 wren ng thornton -- License : BSD3 -- Maintainer : wren@community.haskell.org -- Stability : experimental -- Portability : portable -- -- 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". ---------------------------------------------------------------- module Prelude.Extras ( swap , MonadPlus(..) , liftM ) where -- I use these all the time, it's a shame they're not considered -- basic enough to make it into the "Prelude" import Control.Monad (MonadPlus(..), liftM) ---------------------------------------------------------------- -- | Swap the order of a tuple pair. -- This is provided by "Data.Tuple" as of @base-4.3.0.0@ swap :: (a,b) -> (b,a) swap (x,y) = (y,x) {-# INLINE swap #-} ---------------------------------------------------------------- ----------------------------------------------------------- fin.