From 41f0208eabdb92852b6e463406aca68d32e08d8c Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 14 Mar 2005 15:46:12 +0000 Subject: [PATCH] [project @ 2005-03-14 15:46:12 by simonmar] Add Data.Ord and Data.Eq. Data.Ord also exports the new function 'comparing', as discussed on the libraries list a while back. --- Data/Eq.hs | 22 ++++++++++++++++++++++ Data/Ord.hs | 27 +++++++++++++++++++++++++++ Prelude.hs | 4 +++- base.cabal | 2 ++ package.conf.in | 2 ++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 Data/Eq.hs create mode 100644 Data/Ord.hs diff --git a/Data/Eq.hs b/Data/Eq.hs new file mode 100644 index 0000000..2020233 --- /dev/null +++ b/Data/Eq.hs @@ -0,0 +1,22 @@ +{-# OPTIONS_GHC -fno-implicit-prelude #-} +----------------------------------------------------------------------------- +-- | +-- Module : Data.Eq +-- Copyright : (c) The University of Glasgow 2005 +-- License : BSD-style (see the file libraries/base/LICENSE) +-- +-- Maintainer : libraries@haskell.org +-- Stability : stable +-- Portability : portable +-- +-- Equality +-- +----------------------------------------------------------------------------- + +module Data.Eq ( + Eq(..), + ) where + +#if __GLASGOW_HASKELL__ +import GHC.Base +#endif diff --git a/Data/Ord.hs b/Data/Ord.hs new file mode 100644 index 0000000..2be636c --- /dev/null +++ b/Data/Ord.hs @@ -0,0 +1,27 @@ +{-# OPTIONS_GHC -fno-implicit-prelude #-} +----------------------------------------------------------------------------- +-- | +-- Module : Data.Ord +-- Copyright : (c) The University of Glasgow 2005 +-- License : BSD-style (see the file libraries/base/LICENSE) +-- +-- Maintainer : libraries@haskell.org +-- Stability : stable +-- Portability : portable +-- +-- Orderings +-- +----------------------------------------------------------------------------- + +module Data.Ord ( + Ord(..), + Ordering, + comparing, + ) where + +#if __GLASGOW_HASKELL__ +import GHC.Base +#endif + +comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering +comparing p x y = compare (p x) (p y) diff --git a/Prelude.hs b/Prelude.hs index 578ba7b..2f0a510 100644 --- a/Prelude.hs +++ b/Prelude.hs @@ -172,10 +172,12 @@ import GHC.Err ( error, undefined ) import Hugs.Prelude #endif +import Data.Eq +import Data.Ord + #ifndef __HUGS__ infixr 0 $! - -- ----------------------------------------------------------------------------- -- Miscellaneous functions diff --git a/base.cabal b/base.cabal index 1a920de..2124d35 100644 --- a/base.cabal +++ b/base.cabal @@ -40,6 +40,7 @@ exposed-modules: Data.Complex, Data.Dynamic, Data.Either, + Data.Eq, Data.FiniteMap, Data.FunctorM, -- Data.Generics, @@ -60,6 +61,7 @@ exposed-modules: Data.Maybe, Data.Map, Data.Monoid, + Data.Ord, Data.PackedString, Data.Queue, Data.Ratio, diff --git a/package.conf.in b/package.conf.in index 91a64ce..a68f25d 100644 --- a/package.conf.in +++ b/package.conf.in @@ -38,6 +38,7 @@ exposed-modules: Data.Complex, Data.Dynamic, Data.Either, + Data.Eq, Data.FiniteMap, Data.FunctorM, Data.Generics, @@ -58,6 +59,7 @@ exposed-modules: Data.Maybe, Data.Map, Data.Monoid, + Data.Ord, Data.PackedString, Data.Queue, Data.Ratio, -- 1.7.10.4