diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2022-03-11 16:47:20 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-12 07:05:16 -0500 |
commit | c82fb93476b9c32698f8c069e631d94fd6458666 (patch) | |
tree | 97e0bd255015678595f484274930799ef1a8da92 | |
parent | c062fac0023dd9a6077a0067b61ce39e32617eec (diff) | |
download | haskell-c82fb93476b9c32698f8c069e631d94fd6458666.tar.gz |
Hadrian: avoid allocations in WayUnit's Read instance (#19209)
-rw-r--r-- | hadrian/src/Way/Type.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hadrian/src/Way/Type.hs b/hadrian/src/Way/Type.hs index 4055ff4798..257fce8c47 100644 --- a/hadrian/src/Way/Type.hs +++ b/hadrian/src/Way/Type.hs @@ -27,8 +27,15 @@ instance Show WayUnit where Logging -> "l" Dynamic -> "dyn" +-- TODO: get rid of non-derived Read instance instance Read WayUnit where - readsPrec _ s = [(unit, "") | unit <- [minBound ..], show unit == s] + readsPrec _ = \case + "thr" -> [(Threaded,"")] + "debug" -> [(Debug,"")] + "p" -> [(Profiling,"")] + "l" -> [(Logging,"")] + "dyn" -> [(Dynamic,"")] + _ -> [] -- | Collection of 'WayUnit's that stands for the different ways source code -- is to be built. |