summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Binary.hs2
-rw-r--r--compiler/utils/GraphColor.hs6
-rw-r--r--compiler/utils/GraphOps.hs24
-rw-r--r--compiler/utils/GraphPpr.hs9
-rw-r--r--compiler/utils/Maybes.hs4
-rw-r--r--compiler/utils/Serialized.hs4
-rw-r--r--compiler/utils/UniqSet.hs2
7 files changed, 25 insertions, 26 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 1e85a73d0e..a83e613029 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -549,7 +549,7 @@ writeByteArray arr i (W8# w) = IO $ \s ->
indexByteArray :: ByteArray# -> Int# -> Word8
indexByteArray a# n# = W8# (indexWord8Array# a# n#)
-instance (Integral a, Binary a) => Binary (Ratio a) where
+instance (Binary a) => Binary (Ratio a) where
put_ bh (a :% b) = do put_ bh a; put_ bh b
get bh = do a <- get bh; b <- get bh; return (a :% b)
diff --git a/compiler/utils/GraphColor.hs b/compiler/utils/GraphColor.hs
index 7ba8efbd03..41b367692a 100644
--- a/compiler/utils/GraphColor.hs
+++ b/compiler/utils/GraphColor.hs
@@ -34,7 +34,7 @@ import Data.List
--
colorGraph
:: ( Uniquable k, Uniquable cls, Uniquable color
- , Eq color, Eq cls, Ord k
+ , Eq cls, Ord k
, Outputable k, Outputable cls, Outputable color)
=> Bool -- ^ whether to do iterative coalescing
-> Int -- ^ how many times we've tried to color this graph so far.
@@ -250,7 +250,7 @@ colorScan_spill iterative triv spill graph
assignColors
:: ( Uniquable k, Uniquable cls, Uniquable color
- , Eq color, Outputable cls)
+ , Outputable cls)
=> UniqFM (UniqSet color) -- ^ map of (node class -> set of colors available for this class).
-> Graph k cls color -- ^ the graph
-> [k] -- ^ nodes to assign a color to.
@@ -288,7 +288,7 @@ assignColors colors graph ks
--
selectColor
:: ( Uniquable k, Uniquable cls, Uniquable color
- , Eq color, Outputable cls)
+ , Outputable cls)
=> UniqFM (UniqSet color) -- ^ map of (node class -> set of colors available for this class).
-> Graph k cls color -- ^ the graph
-> k -- ^ key of the node to select a color for.
diff --git a/compiler/utils/GraphOps.hs b/compiler/utils/GraphOps.hs
index 7bf3ecdffb..804153dad2 100644
--- a/compiler/utils/GraphOps.hs
+++ b/compiler/utils/GraphOps.hs
@@ -76,7 +76,7 @@ addNode k node graph
-- | Delete a node and all its edges from the graph.
-delNode :: (Uniquable k, Outputable k)
+delNode :: (Uniquable k)
=> k -> Graph k cls color -> Maybe (Graph k cls color)
delNode k graph
@@ -119,16 +119,14 @@ modNode f k graph
-- | Get the size of the graph, O(n)
-size :: Uniquable k
- => Graph k cls color -> Int
+size :: Graph k cls color -> Int
size graph
= sizeUFM $ graphMap graph
-- | Union two graphs together.
-union :: Uniquable k
- => Graph k cls color -> Graph k cls color -> Graph k cls color
+union :: Graph k cls color -> Graph k cls color -> Graph k cls color
union graph1 graph2
= Graph
@@ -333,7 +331,7 @@ coalesceGraph' aggressive triv graph kkPairsAcc
-- Nothing if either of the nodes weren't in the graph
coalesceNodes
- :: (Uniquable k, Ord k, Eq cls, Outputable k)
+ :: (Uniquable k, Ord k, Eq cls)
=> Bool -- ^ If True, coalesce nodes even if this might make the graph
-- less colorable (aggressive coalescing)
-> Triv k cls color
@@ -364,7 +362,7 @@ coalesceNodes aggressive triv graph (k1, k2)
= (graph, Nothing)
coalesceNodes_merge
- :: (Uniquable k, Ord k, Eq cls, Outputable k)
+ :: (Uniquable k, Eq cls)
=> Bool
-> Triv k cls color
-> Graph k cls color
@@ -410,7 +408,7 @@ coalesceNodes_merge aggressive triv graph kMin kMax nMin nMax
in coalesceNodes_check aggressive triv graph kMin kMax node
coalesceNodes_check
- :: (Uniquable k, Ord k, Eq cls, Outputable k)
+ :: Uniquable k
=> Bool
-> Triv k cls color
-> Graph k cls color
@@ -483,7 +481,7 @@ freezeNode k
-- right here, and add it to a worklist if known triv\/non-move nodes.
--
freezeOneInGraph
- :: (Uniquable k, Outputable k)
+ :: (Uniquable k)
=> Graph k cls color
-> ( Graph k cls color -- the new graph
, Bool ) -- whether we found a node to freeze
@@ -512,7 +510,7 @@ freezeOneInGraph graph
-- for debugging the iterative allocator.
--
freezeAllInGraph
- :: (Uniquable k, Outputable k)
+ :: (Uniquable k)
=> Graph k cls color
-> Graph k cls color
@@ -525,8 +523,7 @@ freezeAllInGraph graph
-- | Find all the nodes in the graph that meet some criteria
--
scanGraph
- :: Uniquable k
- => (Node k cls color -> Bool)
+ :: (Node k cls color -> Bool)
-> Graph k cls color
-> [Node k cls color]
@@ -611,8 +608,7 @@ checkNode graph node
-- | Slurp out a map of how many nodes had a certain number of conflict neighbours
slurpNodeConflictCount
- :: Uniquable k
- => Graph k cls color
+ :: Graph k cls color
-> UniqFM (Int, Int) -- ^ (conflict neighbours, num nodes with that many conflicts)
slurpNodeConflictCount graph
diff --git a/compiler/utils/GraphPpr.hs b/compiler/utils/GraphPpr.hs
index df85fddc5b..6f7e9d5bb2 100644
--- a/compiler/utils/GraphPpr.hs
+++ b/compiler/utils/GraphPpr.hs
@@ -20,7 +20,7 @@ import Data.Maybe
-- | Pretty print a graph in a somewhat human readable format.
dumpGraph
- :: (Outputable k, Outputable cls, Outputable color)
+ :: (Outputable k, Outputable color)
=> Graph k cls color -> SDoc
dumpGraph graph
@@ -28,7 +28,7 @@ dumpGraph graph
$$ (vcat $ map dumpNode $ eltsUFM $ graphMap graph)
dumpNode
- :: (Outputable k, Outputable cls, Outputable color)
+ :: (Outputable k, Outputable color)
=> Node k cls color -> SDoc
dumpNode node
@@ -74,8 +74,7 @@ dotGraph colorMap triv graph
, space ])
-dotNode :: ( Uniquable k
- , Outputable k, Outputable cls, Outputable color)
+dotNode :: ( Outputable k, Outputable cls, Outputable color)
=> (color -> SDoc)
-> Triv k cls color
-> Node k cls color -> SDoc
@@ -132,7 +131,7 @@ dotNode colorMap triv node
dotNodeEdges
:: ( Uniquable k
- , Outputable k, Outputable cls, Outputable color)
+ , Outputable k)
=> UniqSet k
-> Node k cls color
-> (UniqSet k, Maybe SDoc)
diff --git a/compiler/utils/Maybes.hs b/compiler/utils/Maybes.hs
index fc8e3199ae..f5083fdab5 100644
--- a/compiler/utils/Maybes.hs
+++ b/compiler/utils/Maybes.hs
@@ -67,7 +67,11 @@ newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)}
instance Functor m => Functor (MaybeT m) where
fmap f x = MaybeT $ fmap (fmap f) $ runMaybeT x
+#if __GLASGOW_HASKELL__ < 710
instance (Monad m, Functor m) => Applicative (MaybeT m) where
+#else
+instance (Monad m) => Applicative (MaybeT m) where
+#endif
pure = return
(<*>) = ap
diff --git a/compiler/utils/Serialized.hs b/compiler/utils/Serialized.hs
index b1576a087f..d4e0048467 100644
--- a/compiler/utils/Serialized.hs
+++ b/compiler/utils/Serialized.hs
@@ -100,7 +100,7 @@ deserializeConstr bytes k = deserializeWord8 bytes $ \constr_ix bytes ->
serializeFixedWidthNum :: forall a. (Num a, Integral a, Bits a) => a -> [Word8] -> [Word8]
serializeFixedWidthNum what = go (bitSize what) what
#else
-serializeFixedWidthNum :: forall a. (Num a, Integral a, FiniteBits a) => a -> [Word8] -> [Word8]
+serializeFixedWidthNum :: forall a. (Integral a, FiniteBits a) => a -> [Word8] -> [Word8]
serializeFixedWidthNum what = go (finiteBitSize what) what
#endif
where
@@ -113,7 +113,7 @@ serializeFixedWidthNum what = go (finiteBitSize what) what
deserializeFixedWidthNum :: forall a b. (Num a, Integral a, Bits a) => [Word8] -> (a -> [Word8] -> b) -> b
deserializeFixedWidthNum bytes k = go (bitSize (undefined :: a)) bytes k
#else
-deserializeFixedWidthNum :: forall a b. (Num a, Integral a, FiniteBits a) => [Word8] -> (a -> [Word8] -> b) -> b
+deserializeFixedWidthNum :: forall a b. (Integral a, FiniteBits a) => [Word8] -> (a -> [Word8] -> b) -> b
deserializeFixedWidthNum bytes k = go (finiteBitSize (undefined :: a)) bytes k
#endif
where
diff --git a/compiler/utils/UniqSet.hs b/compiler/utils/UniqSet.hs
index 5a82303157..4ceeec0000 100644
--- a/compiler/utils/UniqSet.hs
+++ b/compiler/utils/UniqSet.hs
@@ -54,7 +54,7 @@ addOneToUniqSet_C :: Uniquable a => (a -> a -> a) -> UniqSet a -> a -> UniqSet a
addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
-delOneFromUniqSet_Directly :: Uniquable a => UniqSet a -> Unique -> UniqSet a
+delOneFromUniqSet_Directly :: UniqSet a -> Unique -> UniqSet a
delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a