Skip to content

Remove some long deprecated functions #1046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions containers-tests/containers-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ library

if impl(ghc)
other-modules:
Data.IntMap.Internal.DeprecatedDebug
Data.Map.Internal.DeprecatedShowTree
Utils.Containers.Internal.TypeError

if impl(ghc >= 8.6)
Expand Down
4 changes: 2 additions & 2 deletions containers-tests/tests/intmap-properties.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{-# LANGUAGE CPP #-}

#ifdef STRICT
import Data.IntMap.Strict as Data.IntMap hiding (showTree)
import Data.IntMap.Strict as Data.IntMap
import Data.IntMap.Strict.Internal (traverseMaybeWithKey)
import Data.IntMap.Merge.Strict
#else
import Data.IntMap.Lazy as Data.IntMap hiding (showTree)
import Data.IntMap.Lazy as Data.IntMap
import Data.IntMap.Internal (traverseMaybeWithKey)
import Data.IntMap.Merge.Lazy
#endif
Expand Down
4 changes: 2 additions & 2 deletions containers-tests/tests/map-properties.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{-# LANGUAGE CPP #-}

#ifdef STRICT
import Data.Map.Strict as Data.Map hiding (showTree, showTreeWith)
import Data.Map.Strict as Data.Map
import Data.Map.Merge.Strict
#else
import Data.Map.Lazy as Data.Map hiding (showTree, showTreeWith)
import Data.Map.Lazy as Data.Map
import Data.Map.Merge.Lazy
#endif
import Data.Map.Internal (Map (..), link2, link, bin)
Expand Down
3 changes: 3 additions & 0 deletions containers/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
Previously they were lazier and did not force the first value in runs of at
least 2 entries with equal keys. (Soumik Sarkar)

* Various deprecated functions, whose definitions currently cause type errors,
have been removed. (Soumik Sarkar)

### Bug fixes

* `Data.Map.Strict.mergeWithKey` now forces the result of the combining function
Expand Down
2 changes: 0 additions & 2 deletions containers/containers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,5 @@ Library
if impl(ghc)
other-modules:
Utils.Containers.Internal.TypeError
Data.Map.Internal.DeprecatedShowTree
Data.IntMap.Internal.DeprecatedDebug

include-dirs: include
56 changes: 5 additions & 51 deletions containers/src/Data/IntMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Safe #-}
#endif
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
#endif

#include "containers.h"

Expand All @@ -19,25 +14,20 @@
-- Maintainer : [email protected]
-- Portability : portable
--
-- An efficient implementation of maps from integer keys to values
-- (dictionaries).
-- The @'IntMap' v@ type represents a finite map (sometimes called a dictionary)
-- from key of type @Int@ to values of type @v@.
--
-- This module re-exports the value lazy "Data.IntMap.Lazy" API, plus
-- several deprecated value strict functions. Please note that these functions
-- have different strictness properties than those in "Data.IntMap.Strict":
-- they only evaluate the result of the combining function. For example, the
-- default value to 'insertWith'' is only evaluated if the combining function
-- is called and uses it.
-- This module re-exports the value lazy "Data.IntMap.Lazy" API.
--
-- These modules are intended to be imported qualified, to avoid name
-- This module is intended to be imported qualified, to avoid name
-- clashes with Prelude functions, e.g.
--
-- > import Data.IntMap (IntMap)
-- > import qualified Data.IntMap as IntMap
--
-- The implementation is based on /big-endian patricia trees/. This data
-- structure performs especially well on binary operations like 'union'
-- and 'intersection'. However, my benchmarks show that it is also
-- and 'intersection'. Additionally, benchmarks show that it is also
-- (much) faster on insertions and deletions when compared to a generic
-- size-balanced map implementation (see "Data.Map").
--
Expand Down Expand Up @@ -80,42 +70,6 @@

module Data.IntMap
( module Data.IntMap.Lazy
#ifdef __GLASGOW_HASKELL__
-- For GHC, we disable these, pending removal. For anything else,
-- we just don't define them at all.
, insertWith'
, insertWithKey'
, fold
, foldWithKey
#endif
) where

import Data.IntMap.Lazy

#ifdef __GLASGOW_HASKELL__
import Utils.Containers.Internal.TypeError

-- | This function is being removed and is no longer usable.
-- Use 'Data.IntMap.Strict.insertWith'
insertWith' :: Whoops "Data.IntMap.insertWith' is gone. Use Data.IntMap.Strict.insertWith."
=> (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
insertWith' _ _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'Data.IntMap.Strict.insertWithKey'.
insertWithKey' :: Whoops "Data.IntMap.insertWithKey' is gone. Use Data.IntMap.Strict.insertWithKey."
=> (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
insertWithKey' _ _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'Data.IntMap.Lazy.foldr'.
fold :: Whoops "Data.IntMap.fold' is gone. Use Data.IntMap.foldr or Prelude.foldr."
=> (a -> b -> b) -> b -> IntMap a -> b
fold _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'foldrWithKey'.
foldWithKey :: Whoops "Data.IntMap.foldWithKey is gone. Use foldrWithKey."
=> (Key -> a -> b -> b) -> b -> IntMap a -> b
foldWithKey _ _ _ = undefined
#endif
17 changes: 0 additions & 17 deletions containers/src/Data/IntMap/Internal/DeprecatedDebug.hs

This file was deleted.

11 changes: 1 addition & 10 deletions containers/src/Data/IntMap/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,7 @@ module Data.IntMap.Lazy (
, maxView
, minViewWithKey
, maxViewWithKey

#ifdef __GLASGOW_HASKELL__
-- * Debugging
, showTree
, showTreeWith
#endif
) where

import Data.IntSet.Internal.IntTreeCommons (Key)
import Data.IntMap.Internal as IM hiding (showTree, showTreeWith)
#ifdef __GLASGOW_HASKELL__
import Data.IntMap.Internal.DeprecatedDebug
#endif
import Data.IntMap.Internal as IM
7 changes: 0 additions & 7 deletions containers/src/Data/IntMap/Strict.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Trustworthy #-}
#endif
Expand Down Expand Up @@ -257,12 +256,6 @@ module Data.IntMap.Strict (
, maxView
, minViewWithKey
, maxViewWithKey

#ifdef __GLASGOW_HASKELL__
-- * Debugging
, showTree
, showTreeWith
#endif
) where

import Data.IntMap.Strict.Internal
Expand Down
9 changes: 0 additions & 9 deletions containers/src/Data/IntMap/Strict/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,6 @@ module Data.IntMap.Strict.Internal (
, maxView
, minViewWithKey
, maxViewWithKey

#ifdef __GLASGOW_HASKELL__
-- * Debugging
, showTree
, showTreeWith
#endif
) where

import Utils.Containers.Internal.Prelude hiding
Expand Down Expand Up @@ -351,9 +345,6 @@ import Data.IntMap.Internal
, unions
, withoutKeys
)
#ifdef __GLASGOW_HASKELL__
import Data.IntMap.Internal.DeprecatedDebug (showTree, showTreeWith)
#endif
import qualified Data.IntSet.Internal as IntSet
import Utils.Containers.Internal.BitUtil
import Utils.Containers.Internal.StrictPair
Expand Down
60 changes: 5 additions & 55 deletions containers/src/Data/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
{-# LANGUAGE Safe #-}
#endif

#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE DataKinds, FlexibleContexts, MonoLocalBinds #-}
#endif

#include "containers.h"

-----------------------------------------------------------------------------
Expand All @@ -18,17 +14,13 @@
-- Maintainer : [email protected]
-- Portability : portable
--
-- /Note:/ You should use "Data.Map.Strict" instead of this module if:
--
-- * You will eventually need all the values stored.
-- The @'Map' k v@ type represents a finite map (sometimes called a dictionary)
-- from keys of type @k@ to values of type @v@. A 'Map' is strict in its keys but lazy
-- in its values.
--
-- * The stored values don't represent large virtual data structures
-- to be lazily computed.
-- This module re-exports the value lazy "Data.Map.Lazy" API.
--
-- An efficient implementation of ordered maps from keys to values
-- (dictionaries).
--
-- These modules are intended to be imported qualified, to avoid name
-- This module is intended to be imported qualified, to avoid name
-- clashes with Prelude functions, e.g.
--
-- > import qualified Data.Map as Map
Expand Down Expand Up @@ -70,48 +62,6 @@

module Data.Map
( module Data.Map.Lazy
#ifdef __GLASGOW_HASKELL__
, insertWith'
, insertWithKey'
, insertLookupWithKey'
, fold
, foldWithKey
#endif
) where

import Data.Map.Lazy

#ifdef __GLASGOW_HASKELL__
import Utils.Containers.Internal.TypeError

-- | This function is being removed and is no longer usable.
-- Use 'Data.Map.Strict.insertWith'.
insertWith' :: Whoops "Data.Map.insertWith' is gone. Use Data.Map.Strict.insertWith."
=> (a -> a -> a) -> k -> a -> Map k a -> Map k a
insertWith' _ _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'Data.Map.Strict.insertWithKey'.
insertWithKey' :: Whoops "Data.Map.insertWithKey' is gone. Use Data.Map.Strict.insertWithKey."
=> (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
insertWithKey' _ _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'Data.Map.Strict.insertLookupWithKey'.
insertLookupWithKey' :: Whoops "Data.Map.insertLookupWithKey' is gone. Use Data.Map.Strict.insertLookupWithKey."
=> (k -> a -> a -> a) -> k -> a -> Map k a
-> (Maybe a, Map k a)
insertLookupWithKey' _ _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'Data.Map.Strict.foldr'.
fold :: Whoops "Data.Map.fold is gone. Use foldr."
=> (a -> b -> b) -> b -> Map k a -> b
fold _ _ _ = undefined

-- | This function is being removed and is no longer usable.
-- Use 'foldrWithKey'.
foldWithKey :: Whoops "Data.Map.foldWithKey is gone. Use foldrWithKey."
=> (k -> a -> b -> b) -> b -> Map k a -> b
foldWithKey _ _ _ = undefined
#endif
21 changes: 0 additions & 21 deletions containers/src/Data/Map/Internal/DeprecatedShowTree.hs

This file was deleted.

5 changes: 0 additions & 5 deletions containers/src/Data/Map/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,9 @@ module Data.Map.Lazy (
, maxViewWithKey

-- * Debugging
#ifdef __GLASGOW_HASKELL__
, showTree
, showTreeWith
#endif
, valid
) where

import Data.Map.Internal
import Data.Map.Internal.DeprecatedShowTree (showTree, showTreeWith)
import Data.Map.Internal.Debug (valid)
import Prelude ()
5 changes: 0 additions & 5 deletions containers/src/Data/Map/Strict.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
#if defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Safe #-}
#endif
Expand Down Expand Up @@ -296,10 +295,6 @@ module Data.Map.Strict
, maxViewWithKey

-- * Debugging
#ifdef __GLASGOW_HASKELL__
, showTree
, showTreeWith
#endif
, valid
) where

Expand Down
7 changes: 0 additions & 7 deletions containers/src/Data/Map/Strict/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,6 @@ module Data.Map.Strict.Internal
, maxViewWithKey

-- * Debugging
#ifdef __GLASGOW_HASKELL__
, showTree
, showTreeWith
#endif
, valid
) where

Expand Down Expand Up @@ -422,9 +418,6 @@ import Data.Map.Internal
, unions
, withoutKeys )

#if defined(__GLASGOW_HASKELL__)
import Data.Map.Internal.DeprecatedShowTree (showTree, showTreeWith)
#endif
import Data.Map.Internal.Debug (valid)

import Control.Applicative (Const (..), liftA3)
Expand Down