diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/Binary.hs | 2 | ||||
-rw-r--r-- | compiler/utils/GraphColor.hs | 2 | ||||
-rw-r--r-- | compiler/utils/GraphOps.hs | 20 | ||||
-rw-r--r-- | compiler/utils/GraphPpr.hs | 7 | ||||
-rw-r--r-- | compiler/utils/Maybes.hs | 4 | ||||
-rw-r--r-- | compiler/utils/Serialized.hs | 4 | ||||
-rw-r--r-- | compiler/utils/UniqSet.hs | 2 |
7 files changed, 20 insertions, 21 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..5ba435984c 100644 --- a/compiler/utils/GraphColor.hs +++ b/compiler/utils/GraphColor.hs @@ -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..7bf101cb5d 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 @@ -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, Outputable 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..ca5d412c60 100644 --- a/compiler/utils/GraphPpr.hs +++ b/compiler/utils/GraphPpr.hs @@ -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 |