[commit: ghc] wip/nfs-locking: Fix Show instances. (31d8890)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:14:28 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/31d88906c1b734a5d2d0dd39b79415547a6affea/ghc

>---------------------------------------------------------------

commit 31d88906c1b734a5d2d0dd39b79415547a6affea
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue Dec 22 04:59:02 2015 +0000

    Fix Show instances.


>---------------------------------------------------------------

31d88906c1b734a5d2d0dd39b79415547a6affea
 src/Oracles/Config/Setting.hs | 8 ++++----
 src/Stage.hs                  | 6 ++----
 src/Target.hs                 | 2 +-
 src/Way.hs                    | 1 +
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/Oracles/Config/Setting.hs b/src/Oracles/Config/Setting.hs
index fa62f97..8f0b1df 100644
--- a/src/Oracles/Config/Setting.hs
+++ b/src/Oracles/Config/Setting.hs
@@ -85,10 +85,10 @@ setting key = askConfig $ case key of
 
 settingList :: SettingList -> Action [String]
 settingList key = fmap words $ askConfig $ case key of
-    ConfCcArgs        stage -> "conf-cc-args-stage"         ++ show stage
-    ConfCppArgs       stage -> "conf-cpp-args-stage"        ++ show stage
-    ConfGccLinkerArgs stage -> "conf-gcc-linker-args-stage" ++ show stage
-    ConfLdLinkerArgs  stage -> "conf-ld-linker-args-stage"  ++ show stage
+    ConfCcArgs        stage -> "conf-cc-args-stage"         ++ show (fromEnum stage)
+    ConfCppArgs       stage -> "conf-cpp-args-stage"        ++ show (fromEnum stage)
+    ConfGccLinkerArgs stage -> "conf-gcc-linker-args-stage" ++ show (fromEnum stage)
+    ConfLdLinkerArgs  stage -> "conf-ld-linker-args-stage"  ++ show (fromEnum stage)
     GmpIncludeDirs          -> "gmp-include-dirs"
     GmpLibDirs              -> "gmp-lib-dirs"
     HsCppArgs               -> "hs-cpp-args"
diff --git a/src/Stage.hs b/src/Stage.hs
index 3aca206..d474557 100644
--- a/src/Stage.hs
+++ b/src/Stage.hs
@@ -5,10 +5,8 @@ import Base
 import GHC.Generics (Generic)
 
 -- TODO: explain stages
-data Stage = Stage0 | Stage1 | Stage2 | Stage3 deriving (Eq, Enum, Generic)
-
-instance Show Stage where
-    show = show . fromEnum
+data Stage = Stage0 | Stage1 | Stage2 | Stage3
+           deriving (Show, Eq, Ord, Enum, Generic)
 
 -- Instances for storing in the Shake database
 instance Binary Stage
diff --git a/src/Target.hs b/src/Target.hs
index c70790d..2060d04 100644
--- a/src/Target.hs
+++ b/src/Target.hs
@@ -37,7 +37,7 @@ instance Monoid a => Monoid (ReaderT Target Action a) where
 
 -- PartialTarget is a partially constructed Target with fields Stage and
 -- Package only. PartialTarget's are used for generating build rules.
-data PartialTarget = PartialTarget Stage Package
+data PartialTarget = PartialTarget Stage Package deriving Show
 
 -- Convert PartialTarget to Target assuming that unknown fields won't be used.
 fromPartial :: PartialTarget -> Target
diff --git a/src/Way.hs b/src/Way.hs
index 095bd52..28d1365 100644
--- a/src/Way.hs
+++ b/src/Way.hs
@@ -28,6 +28,7 @@ data WayUnit = Threaded
              | GranSim
              deriving (Eq, Enum)
 
+-- TODO: get rid of non-derived Show instances
 instance Show WayUnit where
     show unit = case unit of
         Threaded  -> "thr"



More information about the ghc-commits mailing list