From bc9366635bdecd7a3476f33fb4118b4976a5ebd8 Mon Sep 17 00:00:00 2001 From: ross Date: Fri, 11 Apr 2003 11:10:59 +0000 Subject: [PATCH] [project @ 2003-04-11 11:10:57 by ross] rename Control.Monad.Monoid as Data.Monoid --- Control/Monad/RWS.hs | 3 +-- Control/Monad/Writer.hs | 4 ++-- {Control/Monad => Data}/Monoid.hs | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) rename {Control/Monad => Data}/Monoid.hs (64%) diff --git a/Control/Monad/RWS.hs b/Control/Monad/RWS.hs index 1136986..0492d37 100644 --- a/Control/Monad/RWS.hs +++ b/Control/Monad/RWS.hs @@ -37,13 +37,12 @@ module Control.Monad.RWS ( import Prelude import Control.Monad -import Control.Monad.Monoid import Control.Monad.Fix import Control.Monad.Trans import Control.Monad.Reader import Control.Monad.Writer import Control.Monad.State - +import Data.Monoid newtype RWS r w s a = RWS { runRWS :: r -> s -> (a, s, w) } diff --git a/Control/Monad/Writer.hs b/Control/Monad/Writer.hs index 7b48717..79ec97e 100644 --- a/Control/Monad/Writer.hs +++ b/Control/Monad/Writer.hs @@ -29,18 +29,18 @@ module Control.Monad.Writer ( execWriterT, mapWriterT, module Control.Monad, - module Control.Monad.Monoid, module Control.Monad.Fix, module Control.Monad.Trans, + module Data.Monoid, ) where import Prelude import Control.Monad -import Control.Monad.Monoid import Control.Monad.Fix import Control.Monad.Trans import Control.Monad.Reader +import Data.Monoid -- --------------------------------------------------------------------------- -- MonadWriter class diff --git a/Control/Monad/Monoid.hs b/Data/Monoid.hs similarity index 64% rename from Control/Monad/Monoid.hs rename to Data/Monoid.hs index 5965620..a328639 100644 --- a/Control/Monad/Monoid.hs +++ b/Data/Monoid.hs @@ -1,15 +1,15 @@ ----------------------------------------------------------------------------- -- | --- Module : Control.Monad.Monoid +-- Module : Data.Monoid -- Copyright : (c) Andy Gill 2001, -- (c) Oregon Graduate Institute of Science and Technology, 2001 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : experimental --- Portability : non-portable ( requires mulit-parameter type classes ) +-- Portability : non-portable (requires extended type classes) -- --- Declaration of the Monoid class,and instances for list and functions +-- Declaration of the Monoid class, and instances for list and functions. -- -- Inspired by the paper -- /Functional Programming with Overloading and @@ -18,24 +18,28 @@ -- Advanced School of Functional Programming, 1995. ----------------------------------------------------------------------------- -module Control.Monad.Monoid ( +module Data.Monoid ( Monoid(..) ) where import Prelude -- --------------------------------------------------------------------------- --- The Monoid class +-- | The monoid class. +-- A minimal complete definition must supply 'mempty' and 'mappend', +-- and these should satisfy the monoid laws. class Monoid a where mempty :: a + -- ^ Identity of 'mappend' mappend :: a -> a -> a + -- ^ An associative operation mconcat :: [a] -> a --- Now the default for mconcat. For most types, this --- default will be used, but is included in the class definition so --- that optimized version of mconcat can be provided --- for specific types. + -- ^ Fold a list using the monoid. + -- For most types, the default definition for 'mconcat' will be + -- used, but the function is included in the class definition so + -- that an optimized version can be provided for specific types. mconcat = foldr mappend mempty -- 1.7.10.4