Subversion

Galculator

[/] [src/] [Control/] [MonadOr.hs] - Rev 1 Go to most recent revision

Compare with Previous - Blame



{-# OPTIONS_GHC -Wall #-}

-------------------------------------------------------------------------------

{- |
Module      :  Control.MonadOr
Description :  MonadOr definition.
Copyright   :  (c) Paulo Silva
License     :  LGPL

Maintainer  :  paufil@di.uminho.pt
Stability   :  experimental
Portability :  portable

Monad definition satisfying the Monoid and Left Catch laws as refered in
<http://www.haskell.org/haskellwiki/MonadPlus_reform_proposal>

-}

-------------------------------------------------------------------------------

module Control.MonadOr (
  MonadOr,
  morelse
 ) where

import Control.Monad

-------------------------------------------------------------------------------

class MonadPlus m => MonadOr m where
  morelse :: m a -> m a -> m a

-------------------------------------------------------------------------------

instance MonadOr [] where
  morelse [] b = b
  morelse a _ = a

-------------------------------------------------------------------------------

-- This instance is equal to mplus for maybe
instance MonadOr Maybe where
  morelse = mplus

-------------------------------------------------------------------------------


Theme by Vikram Singh | Powered by WebSVN v1.61