summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/RegAlloc/Linear/State.hs
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-06-08 20:48:07 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-06-09 14:35:50 +0200
commit4c44e323e8ac0e28e87e93ab53cbf7eb21ac9c25 (patch)
treeb0991218e9cac8f76224df017856045c71d779e4 /compiler/nativeGen/RegAlloc/Linear/State.hs
parent8754002973dcde8709458044e541ddc8f4fcf6bb (diff)
downloadhaskell-wip/derive-functor.tar.gz
Use DeriveFunctor throughout the codebase (#15654)wip/derive-functor
Diffstat (limited to 'compiler/nativeGen/RegAlloc/Linear/State.hs')
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/State.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/nativeGen/RegAlloc/Linear/State.hs b/compiler/nativeGen/RegAlloc/Linear/State.hs
index 8df4dd04f0..43b8f6c129 100644
--- a/compiler/nativeGen/RegAlloc/Linear/State.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/State.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, PatternSynonyms #-}
+{-# LANGUAGE CPP, PatternSynonyms, DeriveFunctor #-}
#if !defined(GHC_LOADED_INTO_GHCI)
{-# LANGUAGE UnboxedTuples #-}
@@ -50,7 +50,7 @@ import DynFlags
import Unique
import UniqSupply
-import Control.Monad (liftM, ap)
+import Control.Monad (ap)
-- Avoids using unboxed tuples when loading into GHCi
#if !defined(GHC_LOADED_INTO_GHCI)
@@ -63,15 +63,14 @@ pattern RA_Result a b = (# a, b #)
#else
data RA_Result freeRegs a = RA_Result {-# UNPACK #-} !(RA_State freeRegs) !a
+ deriving (Functor)
#endif
-- | The register allocator monad type.
newtype RegM freeRegs a
= RegM { unReg :: RA_State freeRegs -> RA_Result freeRegs a }
-
-instance Functor (RegM freeRegs) where
- fmap = liftM
+ deriving (Functor)
instance Applicative (RegM freeRegs) where
pure a = RegM $ \s -> RA_Result s a