Skip to content
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

Fix unused imports and other warnings #137

Merged
merged 6 commits into from
May 27, 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
1 change: 0 additions & 1 deletion benchmarks/HeapSort.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module HeapSort where

import Data.PQueue.Min (MinQueue)
import qualified Data.PQueue.Min as P
import System.Random

Expand Down
1 change: 0 additions & 1 deletion benchmarks/KWay/PrioMergeAlg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module KWay.PrioMergeAlg
) where

import qualified Data.PQueue.Prio.Min as P
import System.Random (StdGen)
import Data.Word
import Data.List (unfoldr)
import KWay.RandomIncreasing
Expand Down
1 change: 0 additions & 1 deletion benchmarks/KWay/RandomIncreasing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module KWay.RandomIncreasing where

import System.Random
import Data.Word
import Data.List (unfoldr)

data Stream = Stream !Word64 {-# UNPACK #-} !StdGen

Expand Down
1 change: 0 additions & 1 deletion benchmarks/PHeapSort.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module PHeapSort where

import Data.PQueue.Prio.Min (MinPQueue)
import qualified Data.PQueue.Prio.Min as P
import System.Random

Expand Down
3 changes: 0 additions & 3 deletions pqueue.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ library
-fspec-constr
-fdicts-strict
-Wall
if impl(ghc >= 8.0)
ghc-options:
-fno-warn-unused-imports

test-suite test
hs-source-dirs: src, tests
Expand Down
2 changes: 2 additions & 0 deletions src/BinomialQueue/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ module BinomialQueue.Internals (
) where

import Control.DeepSeq (NFData(rnf), deepseq)
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
#endif
import Data.Function (on)
#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup(..), stimesMonoid)
Expand Down
15 changes: 1 addition & 14 deletions src/BinomialQueue/Max.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,13 @@ module BinomialQueue.Max (
import Prelude hiding (null, take, drop, takeWhile, dropWhile, splitAt, span, break, (!!), filter, map)

import Data.Coerce (coerce)
import Data.Foldable (foldl')
import Data.Maybe (fromMaybe)
import Data.Bifunctor (bimap)

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup((<>)))
#endif

import qualified Data.List as List
import Data.Maybe (fromMaybe)

import qualified BinomialQueue.Min as MinQ
import Data.PQueue.Internals.Down

#ifdef __GLASGOW_HASKELL__
import GHC.Exts (build)
#else
build :: ((a -> [a] -> [a]) -> [a] -> [a]) -> [a]
build f = f (:) []
#endif

newtype MaxQueue a = MaxQueue { unMaxQueue :: MinQ.MinQueue (Down a) }

-- | \(O(\log n)\). Returns the minimum element. Throws an error on an empty queue.
Expand Down
14 changes: 2 additions & 12 deletions src/BinomialQueue/Min.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,14 @@ module BinomialQueue.Min (

import Prelude hiding (null, take, drop, takeWhile, dropWhile, splitAt, span, break, (!!), filter, map)

#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
import Data.Maybe (fromMaybe)

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup((<>)))
#endif

import qualified Data.List as List
import Data.Maybe (fromMaybe)

import BinomialQueue.Internals

#ifdef __GLASGOW_HASKELL__
import GHC.Exts (build)
#else
build :: ((a -> [a] -> [a]) -> [a] -> [a]) -> [a]
build f = f (:) []
#endif

-- | \(O(\log n)\). Returns the minimum element. Throws an error on an empty queue.
findMin :: Ord a => MinQueue a -> a
findMin = fromMaybe (error "Error: findMin called on empty queue") . getMin
Expand Down
5 changes: 2 additions & 3 deletions src/Data/PQueue/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ import BinomialQueue.Internals
, BinomTree (..)
, Succ (..)
, Zero (..)
, Extract (..)
, MExtract (..)
)
import qualified BinomialQueue.Internals as BQ
import Control.DeepSeq (NFData(rnf), deepseq)
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
#endif
#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup(..), stimesMonoid)
#endif

import Data.PQueue.Internals.Foldable
#ifdef __GLASGOW_HASKELL__
import Data.Data
import Text.Read (Lexeme(Ident), lexP, parens, prec,
Expand Down
6 changes: 3 additions & 3 deletions src/Data/PQueue/Max.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ module Data.PQueue.Max (
import Control.DeepSeq (NFData(rnf))

import Data.Coerce (coerce)
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
#endif
import Data.Maybe (fromMaybe)

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup(..), stimesMonoid)
#endif

import Data.Foldable (foldl')

import qualified Data.PQueue.Min as Min
import qualified Data.PQueue.Prio.Max.Internals as Prio
import Data.PQueue.Internals.Down (Down(..))
Expand Down
16 changes: 4 additions & 12 deletions src/Data/PQueue/Min.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,18 @@ module Data.PQueue.Min (

import Prelude hiding (null, take, drop, takeWhile, dropWhile, splitAt, span, break, (!!), filter, map)

#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
import Data.Maybe (fromMaybe)

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup((<>)))
#endif

import qualified Data.List as List
import Data.Maybe (fromMaybe)

import Data.PQueue.Internals hiding (MinQueue (..))
import Data.PQueue.Internals (MinQueue (MinQueue))
import qualified Data.PQueue.Internals as Internals
import qualified BinomialQueue.Internals as BQ
import qualified Data.PQueue.Prio.Internals as Prio

#ifdef __GLASGOW_HASKELL__
import GHC.Exts (build)
#else
build :: ((a -> [a] -> [a]) -> [a] -> [a]) -> [a]
build f = f (:) []
#endif

#ifdef __GLASGOW_HASKELL__
-- | A bidirectional pattern synonym for an empty priority queue.
--
Expand Down Expand Up @@ -146,7 +136,9 @@ pattern a :< q <- (minView -> Just (a, q))
{-# INLINE (:<) #-}
# endif

# if __GLASGOW_HASKELL__ >= 820
{-# COMPLETE Empty, (:<) #-}
# endif
#endif

-- | \(O(1)\). Returns the minimum element. Throws an error on an empty queue.
Expand Down
6 changes: 5 additions & 1 deletion src/Data/PQueue/Prio/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ module Data.PQueue.Prio.Internals (
unions
) where

import Control.Applicative (liftA2, liftA3, Const (..))
#if MIN_VERSION_base(4,18,0)
import Control.Applicative (Const (..))
#else
import Control.Applicative (liftA2, Const (..))
#endif
import Control.DeepSeq (NFData(rnf), deepseq)
import Data.Coerce (coerce)
import Data.Functor.Identity (Identity(Identity, runIdentity))
Expand Down
6 changes: 2 additions & 4 deletions src/Data/PQueue/Prio/Min.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ module Data.PQueue.Prio.Min (
import qualified Data.List as List
import Data.Maybe (fromMaybe)

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (Semigroup((<>)))
#endif

import Data.PQueue.Prio.Internals hiding (MinPQueue (..))
import Data.PQueue.Prio.Internals (MinPQueue)
import qualified Data.PQueue.Prio.Internals as Internals
Expand Down Expand Up @@ -172,7 +168,9 @@ pattern ka :< q <- (minViewWithKey -> Just (ka, q))
{-# INLINE (:<) #-}
# endif

# if __GLASGOW_HASKELL__ >= 820
{-# COMPLETE Empty, (:<) #-}
# endif
#endif

(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
Expand Down
6 changes: 6 additions & 0 deletions src/Nattish.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ module Nattish
( Nattish (Zeroy, Succy)
)
where
#if __GLASGOW_HASKELL__ >= 904
import Unsafe.Coerce (unsafeCoerce)
#endif
#if __GLASGOW_HASKELL__ >= 800
import Data.Kind (Type)
#endif
Expand All @@ -38,7 +40,11 @@ import Data.Kind (Type)
-- it is very fast to work with.

#if __GLASGOW_HASKELL__ < 904
#if __GLASGOW_HASKELL__ >= 800
data Nattish :: k -> (k -> k) -> k -> Type where
#else
data Nattish :: k -> (k -> k) -> k -> * where
#endif
Zeroy :: Nattish zero succ zero
Succy :: !(Nattish zero succ n) -> Nattish zero succ (succ n)

Expand Down