From 9e32ed934a78ebe8cf65219949018a5f1035ae7e Mon Sep 17 00:00:00 2001 From: Ross Paterson Date: Sun, 12 Nov 2006 00:10:46 +0000 Subject: [PATCH] remove Data.FunctorM and Data.Queue These were deprecated in 6.6, and can thus be removed in 6.8. --- Data/FunctorM.hs | 46 ----------------------------- Data/Queue.hs | 86 ------------------------------------------------------ Makefile.nhc98 | 4 +-- base.cabal | 2 -- package.conf.in | 2 -- 5 files changed, 2 insertions(+), 138 deletions(-) delete mode 100644 Data/FunctorM.hs delete mode 100644 Data/Queue.hs diff --git a/Data/FunctorM.hs b/Data/FunctorM.hs deleted file mode 100644 index 086c374..0000000 --- a/Data/FunctorM.hs +++ /dev/null @@ -1,46 +0,0 @@ ------------------------------------------------------------------------------ --- | --- Module : Data.FunctorM --- Copyright : (c) The University of Glasgow 2005 --- License : BSD-style (see the file libraries/base/LICENSE) --- --- Maintainer : libraries@haskell.org --- Stability : provisional --- Portability : portable --- --- fmapM generalises fmap, just as mapM generalises map. --- --- NOTE: This module is DEPRECATED. --- The classes in "Data.Foldable" and "Data.Traversable" provide a --- more general interface. --- ------------------------------------------------------------------------------ - -module Data.FunctorM -{-# DEPRECATED "Use the more general Data.Foldable and Data.Traversable instead" #-} - (FunctorM(..)) where - -import Prelude -import Data.Array - -class FunctorM f where - fmapM :: Monad m => (a -> m b) -> f a -> m (f b) - fmapM_ :: Monad m => (a -> m b) -> f a -> m () - - fmapM_ f t = fmapM f t >> return () - -instance FunctorM [] where - fmapM = mapM - fmapM_ = mapM_ - -instance FunctorM Maybe where - fmapM _ Nothing = return Nothing - fmapM f (Just x) = f x >>= return . Just - - fmapM_ _ Nothing = return () - fmapM_ f (Just x) = f x >> return () - -instance Ix i => FunctorM (Array i) where - fmapM f a = do - a' <- sequence [ f e >>= return . (,) i | (i,e) <- assocs a] - return (array (bounds a) a') diff --git a/Data/Queue.hs b/Data/Queue.hs deleted file mode 100644 index 55abe39..0000000 --- a/Data/Queue.hs +++ /dev/null @@ -1,86 +0,0 @@ ------------------------------------------------------------------------------ --- | --- Module : Data.Queue --- Copyright : (c) The University of Glasgow 2002 --- License : BSD-style (see the file libraries/base/LICENSE) --- --- Maintainer : libraries@haskell.org --- Stability : experimental --- Portability : portable --- --- NOTE: This module is DEPRECATED. --- The data structure in "Data.Sequence" is a faster queue and also --- supports a wider variety of operations. --- --- Queues with constant time operations, from --- /Simple and efficient purely functional queues and deques/, --- by Chris Okasaki, /JFP/ 5(4):583-592, October 1995. --- ------------------------------------------------------------------------------ - -module Data.Queue -{-# DEPRECATED "Use Data.Sequence instead: it's faster and has more operations" #-} - (Queue, - -- * Primitive operations - -- | Each of these requires /O(1)/ time in the worst case. - emptyQueue, addToQueue, deQueue, - -- * Queues and lists - listToQueue, queueToList - ) where - -import Prelude -- necessary to get dependencies right -import Data.Typeable - --- | The type of FIFO queues. -data Queue a = Q [a] [a] [a] - -#include "Typeable.h" -INSTANCE_TYPEABLE1(Queue,queueTc,"Queue") - --- Invariants for Q xs ys xs': --- length xs = length ys + length xs' --- xs' = drop (length ys) xs -- in fact, shared (except after fmap) --- The queue then represents the list xs ++ reverse ys - -instance Functor Queue where - fmap f (Q xs ys xs') = Q (map f xs) (map f ys) (map f xs') - -- The new xs' does not share the tail of the new xs, but it does - -- share the tail of the old xs, so it still forces the rotations. - -- Note that elements of xs' are ignored. - --- | The empty queue. -emptyQueue :: Queue a -emptyQueue = Q [] [] [] - --- | Add an element to the back of a queue. -addToQueue :: Queue a -> a -> Queue a -addToQueue (Q xs ys xs') y = makeQ xs (y:ys) xs' - --- | Attempt to extract the front element from a queue. --- If the queue is empty, 'Nothing', --- otherwise the first element paired with the remainder of the queue. -deQueue :: Queue a -> Maybe (a, Queue a) -deQueue (Q [] _ _) = Nothing -deQueue (Q (x:xs) ys xs') = Just (x, makeQ xs ys xs') - --- Assuming --- length ys <= length xs + 1 --- xs' = drop (length ys - 1) xs --- construct a queue respecting the invariant. -makeQ :: [a] -> [a] -> [a] -> Queue a -makeQ xs ys [] = listToQueue (rotate xs ys []) -makeQ xs ys (_:xs') = Q xs ys xs' - --- Assuming length ys = length xs + 1, --- rotate xs ys zs = xs ++ reverse ys ++ zs -rotate :: [a] -> [a] -> [a] -> [a] -rotate [] (y:_) zs = y : zs -- the _ here must be [] -rotate (x:xs) (y:ys) zs = x : rotate xs ys (y:zs) - --- | A queue with the same elements as the list. -listToQueue :: [a] -> Queue a -listToQueue xs = Q xs [] xs - --- | The elements of a queue, front first. -queueToList :: Queue a -> [a] -queueToList (Q xs ys _) = xs ++ reverse ys diff --git a/Makefile.nhc98 b/Makefile.nhc98 index 8109766..e35f515 100644 --- a/Makefile.nhc98 +++ b/Makefile.nhc98 @@ -9,8 +9,8 @@ SRCS = \ Data/Ix.hs Data/List.hs Data/Maybe.hs Data/PackedString.hs \ Data/Ratio.hs Data/Set.hs Data/Tuple.hs Data/Word.hs Data/Array.hs \ Data/HashTable.hs Data/Typeable.hs Data/Dynamic.hs \ - Data/Monoid.hs Data/Queue.hs Data/Tree.hs \ - Data/Map.hs Data/IntMap.hs Data/IntSet.hs Data/FunctorM.hs \ + Data/Monoid.hs Data/Tree.hs \ + Data/Map.hs Data/IntMap.hs Data/IntSet.hs \ Data/Eq.hs Data/Ord.hs \ Data/Foldable.hs Data/Traversable.hs Data/Sequence.hs \ Data/Function.hs \ diff --git a/base.cabal b/base.cabal index 9d76cb4..d74975d 100644 --- a/base.cabal +++ b/base.cabal @@ -51,7 +51,6 @@ exposed-modules: Data.Foldable, Data.Fixed, Data.Function, - Data.FunctorM, -- Data.Generics, -- Data.Generics.Aliases, -- Data.Generics.Basics, @@ -72,7 +71,6 @@ exposed-modules: Data.Monoid, Data.Ord, Data.PackedString, - Data.Queue, Data.Ratio, Data.STRef, Data.STRef.Lazy, diff --git a/package.conf.in b/package.conf.in index b110b7d..d9b23d4 100644 --- a/package.conf.in +++ b/package.conf.in @@ -49,7 +49,6 @@ exposed-modules: Data.Fixed, Data.Foldable, Data.Function, - Data.FunctorM, Data.Generics, Data.Generics.Aliases, Data.Generics.Basics, @@ -70,7 +69,6 @@ exposed-modules: Data.Monoid, Data.Ord, Data.PackedString, - Data.Queue, Data.Ratio, Data.STRef, Data.STRef.Lazy, -- 1.7.10.4