Commit eb86321b authored by Ian Lynagh's avatar Ian Lynagh

Fix warnings in utils/UniqSet

parent 38ac36a3
...@@ -9,29 +9,21 @@ Based on @UniqFMs@ (as you would expect). ...@@ -9,29 +9,21 @@ Based on @UniqFMs@ (as you would expect).
Basically, the things need to be in class @Uniquable@. Basically, the things need to be in class @Uniquable@.
\begin{code} \begin{code}
{-# OPTIONS -w #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and fix
-- any warnings in the module. See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
-- for details
module UniqSet ( module UniqSet (
UniqSet, -- abstract type: NOT UniqSet, -- abstract type: NOT
mkUniqSet, uniqSetToList, emptyUniqSet, unitUniqSet, mkUniqSet, uniqSetToList, emptyUniqSet, unitUniqSet,
addOneToUniqSet, addListToUniqSet, delOneFromUniqSet, delListFromUniqSet, addOneToUniqSet, addListToUniqSet,
unionUniqSets, unionManyUniqSets, minusUniqSet, delOneFromUniqSet, delListFromUniqSet,
elementOfUniqSet, mapUniqSet, intersectUniqSets, unionUniqSets, unionManyUniqSets, minusUniqSet,
isEmptyUniqSet, filterUniqSet, sizeUniqSet, foldUniqSet, elementOfUniqSet, mapUniqSet, intersectUniqSets,
elemUniqSet_Directly, lookupUniqSet, hashUniqSet isEmptyUniqSet, filterUniqSet, sizeUniqSet, foldUniqSet,
elemUniqSet_Directly, lookupUniqSet, hashUniqSet
) where ) where
#include "HsVersions.h" import Maybes
import Maybes ( maybeToBool )
import UniqFM import UniqFM
import Unique ( Unique, Uniquable(..) ) import Unique
#if ! OMIT_NATIVE_CODEGEN #if ! OMIT_NATIVE_CODEGEN
#define IF_NCG(a) a #define IF_NCG(a) a
...@@ -41,9 +33,9 @@ import Unique ( Unique, Uniquable(..) ) ...@@ -41,9 +33,9 @@ import Unique ( Unique, Uniquable(..) )
\end{code} \end{code}
%************************************************************************ %************************************************************************
%* * %* *
\subsection{The @UniqSet@ type} \subsection{The @UniqSet@ type}
%* * %* *
%************************************************************************ %************************************************************************
We use @UniqFM@, with a (@getUnique@-able) @Unique@ as ``key'' We use @UniqFM@, with a (@getUnique@-able) @Unique@ as ``key''
...@@ -65,7 +57,7 @@ uniqSetToList :: UniqSet a -> [a] ...@@ -65,7 +57,7 @@ uniqSetToList :: UniqSet a -> [a]
uniqSetToList (MkUniqSet set) = eltsUFM set uniqSetToList (MkUniqSet set) = eltsUFM set
foldUniqSet :: (a -> b -> b) -> b -> UniqSet a -> b foldUniqSet :: (a -> b -> b) -> b -> UniqSet a -> b
foldUniqSet k z (MkUniqSet set) = foldUFM k z set foldUniqSet k z (MkUniqSet set) = foldUFM k z set
mkUniqSet :: Uniquable a => [a] -> UniqSet a mkUniqSet :: Uniquable a => [a] -> UniqSet a
mkUniqSet xs = MkUniqSet (listToUFM [ (x, x) | x <- xs]) mkUniqSet xs = MkUniqSet (listToUFM [ (x, x) | x <- xs])
...@@ -86,9 +78,9 @@ unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a ...@@ -86,9 +78,9 @@ unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
unionUniqSets (MkUniqSet set1) (MkUniqSet set2) = MkUniqSet (plusUFM set1 set2) unionUniqSets (MkUniqSet set1) (MkUniqSet set2) = MkUniqSet (plusUFM set1 set2)
unionManyUniqSets :: [UniqSet a] -> UniqSet a unionManyUniqSets :: [UniqSet a] -> UniqSet a
-- = foldr unionUniqSets emptyUniqSet ss -- = foldr unionUniqSets emptyUniqSet ss
unionManyUniqSets [] = emptyUniqSet unionManyUniqSets [] = emptyUniqSet
unionManyUniqSets [s] = s unionManyUniqSets [s] = s
unionManyUniqSets (s:ss) = s `unionUniqSets` unionManyUniqSets ss unionManyUniqSets (s:ss) = s `unionUniqSets` unionManyUniqSets ss
minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a
...@@ -134,7 +126,7 @@ mapUniqSet f (MkUniqSet set) = MkUniqSet (mapUFM f set) ...@@ -134,7 +126,7 @@ mapUniqSet f (MkUniqSet set) = MkUniqSet (mapUFM f set)
{- SPECIALIZE {- SPECIALIZE
elementOfUniqSet :: Name -> UniqSet Name -> Bool elementOfUniqSet :: Name -> UniqSet Name -> Bool
, Unique -> UniqSet Unique -> Bool , Unique -> UniqSet Unique -> Bool
-} -}
{- SPECIALIZE {- SPECIALIZE
mkUniqSet :: [Name] -> UniqSet Name mkUniqSet :: [Name] -> UniqSet Name
...@@ -142,7 +134,7 @@ mapUniqSet f (MkUniqSet set) = MkUniqSet (mapUFM f set) ...@@ -142,7 +134,7 @@ mapUniqSet f (MkUniqSet set) = MkUniqSet (mapUFM f set)
{- SPECIALIZE {- SPECIALIZE
unitUniqSet :: Name -> UniqSet Name unitUniqSet :: Name -> UniqSet Name
, Unique -> UniqSet Unique , Unique -> UniqSet Unique
-} -}
#endif #endif
\end{code} \end{code}
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