[PATCH] Add deprecations status of unGetChan and isEmptyChan to Haddock comment

--- Control/Concurrent/Chan.hs | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Control/Concurrent/Chan.hs b/Control/Concurrent/Chan.hs index 23b21bb..2906367 100644 --- a/Control/Concurrent/Chan.hs +++ b/Control/Concurrent/Chan.hs @@ -109,7 +109,11 @@ dupChan (Chan _ writeVar) = do newReadVar <- newMVar hole return (Chan newReadVar writeVar) --- |Put a data item back onto a channel, where it will be the next item read. +-- |Note: This operation is deprecated. +-- If you need this operation, use "Control.Concurrent.STM.TChan" instead. See +-- http://hackage.haskell.org/trac/ghc/ticket/4154 for details. +-- +-- Put a data item back onto a channel, where it will be the next item read. unGetChan :: Chan a -> a -> IO () unGetChan (Chan readVar _) val = do new_read_end <- newEmptyMVar @@ -118,7 +122,11 @@ unGetChan (Chan readVar _) val = do return new_read_end {-# DEPRECATED unGetChan "if you need this operation, use Control.Concurrent.STM.TChan instead. See http://hackage.haskell.org/trac/ghc/ticket/4154 for details" #-} --- |Returns 'True' if the supplied 'Chan' is empty. +-- |Note: This operation is deprecated. +-- If you need this operation, use "Control.Concurrent.STM.TChan" instead. See +-- http://hackage.haskell.org/trac/ghc/ticket/4154 for details. +-- +-- Returns 'True' if the supplied 'Chan' is empty. isEmptyChan :: Chan a -> IO Bool isEmptyChan (Chan readVar writeVar) = do withMVar readVar $ \r -> do -- 1.7.4.1

Hi Simon, On Tue, Aug 09, 2011 at 04:12:26PM +0200, Simon Hengel wrote:
diff --git a/Control/Concurrent/Chan.hs b/Control/Concurrent/Chan.hs
--- |Put a data item back onto a channel, where it will be the next item read. +-- |Note: This operation is deprecated. +-- If you need this operation, use "Control.Concurrent.STM.TChan" instead. See +-- http://hackage.haskell.org/trac/ghc/ticket/4154 for details. +-- +-- Put a data item back onto a channel, where it will be the next item read. unGetChan :: Chan a -> a -> IO () unGetChan (Chan readVar _) val = do new_read_end <- newEmptyMVar @@ -118,7 +122,11 @@ unGetChan (Chan readVar _) val = do return new_read_end {-# DEPRECATED unGetChan "if you need this operation, use Control.Concurrent.STM.TChan instead. See http://hackage.haskell.org/trac/ghc/ticket/4154 for details" #-}
Hmm, I agree the info should be in the docs, but I think it would be better if haddock extracted the info from the pragma, rather than us having to repeat ourselves all the time. Thanks Ian

Hi Ian,
Hmm, I agree the info should be in the docs, but I think it would be better if haddock extracted the info from the pragma, rather than us having to repeat ourselves all the time.
I agree, we even have a ticket for that [1]. I'd still lean toward "repeating ourselves" until that feature is available (this is done for the other deprecated functions in base anyway), but I've no strong opinion about that. Cheers, Simon [1] http://trac.haskell.org/haddock/ticket/38
participants (2)
-
Ian Lynagh
-
Simon Hengel