Commit 361af628 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

base: Remove deprecated Chan combinators

Removes isEmptyChan and unGetChan, which have been deprecated for a very
long time. See #13561.

Test Plan: Validate

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13561

Differential Revision: https://phabricator.haskell.org/D4060
parent 4899a86b
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
-- Module : Control.Concurrent.Chan
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
--
--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
-- Portability : non-portable (concurrency)
......@@ -22,7 +21,7 @@
-----------------------------------------------------------------------------
module Control.Concurrent.Chan
(
(
-- * The 'Chan' type
Chan, -- abstract
......@@ -31,8 +30,6 @@ module Control.Concurrent.Chan
writeChan,
readChan,
dupChan,
unGetChan,
isEmptyChan,
-- * Stream interface
getChanContents,
......@@ -137,24 +134,6 @@ 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.
unGetChan :: Chan a -> a -> IO ()
unGetChan (Chan readVar _) val = do
new_read_end <- newEmptyMVar
modifyMVar_ readVar $ \read_end -> do
putMVar new_read_end (ChItem val read_end)
return new_read_end
{-# DEPRECATED unGetChan "if you need this operation, use Control.Concurrent.STM.TChan instead. See <http://ghc.haskell.org/trac/ghc/ticket/4154> for details" #-} -- deprecated in 7.0
-- |Returns 'True' if the supplied 'Chan' is empty.
isEmptyChan :: Chan a -> IO Bool
isEmptyChan (Chan readVar writeVar) = do
withMVar readVar $ \r -> do
w <- readMVar writeVar
let eq = r == w
eq `seq` return eq
{-# DEPRECATED isEmptyChan "if you need this operation, use Control.Concurrent.STM.TChan instead. See <http://ghc.haskell.org/trac/ghc/ticket/4154> for details" #-} -- deprecated in 7.0
-- Operators for interfacing with functional streams.
-- |Return a lazy list representing the contents of the supplied
......
......@@ -55,6 +55,9 @@
* Add `installSEHHandlers` to `MiscFlags` in `GHC.RTS.Flags` to determine if
exception handling is enabled.
* The deprecated functions `isEmptyChan` and `unGetChan` in
`Control.Concurrent.Chan` have been removed (#13561).
* Add `generateCrashDumpFile` to `MiscFlags` in `GHC.RTS.Flags` to determine
if a core dump will be generated on crashes.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment