[commit: ghc] wip/ttypeable: Add catchalls (973f22f)

git at git.haskell.org git at git.haskell.org
Tue Feb 7 17:29:55 UTC 2017


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

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/973f22fc99299416a132a2ad7f6f767f161c0de9/ghc

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

commit 973f22fc99299416a132a2ad7f6f767f161c0de9
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Feb 2 02:13:15 2017 -0500

    Add catchalls


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

973f22fc99299416a132a2ad7f6f767f161c0de9
 compiler/utils/Binary.hs         | 1 +
 libraries/ghci/GHCi/TH/Binary.hs | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 2782b79..65157bd 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -633,6 +633,7 @@ instance Binary KindRep where
     put_ bh (KindRepFun a b) = putByte bh 3 >> put_ bh a >> put_ bh b
     put_ bh (KindRepTYPE r) = putByte bh 4 >> put_ bh r
     put_ bh (KindRepTypeLit sort r) = putByte bh 5 >> put_ bh sort >> put_ bh r
+    put_ _  _ = fail "Binary.putKindRep: impossible"
 
     get bh = do
         tag <- getByte bh
diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs
index 0d0ea9d..4dfe441 100644
--- a/libraries/ghci/GHCi/TH/Binary.hs
+++ b/libraries/ghci/GHCi/TH/Binary.hs
@@ -135,6 +135,7 @@ instance Binary KindRep where
     put (KindRepFun a b) = putWord8 3 >> put a >> put b
     put (KindRepTYPE r) = putWord8 4 >> put r
     put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r
+    put _ = fail "GHCi.TH.Binary.putKindRep: Impossible"
 
     get = do
         tag <- getWord8
@@ -144,14 +145,14 @@ instance Binary KindRep where
           2 -> KindRepApp <$> get <*> get
           3 -> KindRepFun <$> get <*> get
           4 -> KindRepTYPE <$> get
-          5 -> KindRepTypeList <$> get <*> get
+          5 -> KindRepTypeLit <$> get <*> get
           _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag"
 
 instance Binary TypeLitSort where
     put TypeLitSymbol = putWord8 0
     put TypeLitNat = putWord8 1
-    get bh = do
-        tag <- getWord8 bh
+    get = do
+        tag <- getWord8
         case tag of
           0 -> pure TypeLitSymbol
           1 -> pure TypeLitNat



More information about the ghc-commits mailing list