@@ -994,9 +994,6 @@ instance Binary TypeLitSort where
994994 _ -> fail " GHCi.TH.Binary.putTypeLitSort: invalid tag"
995995
996996putTypeRep :: TypeRep a -> Put
997- -- Special handling for TYPE, (->), and RuntimeRep due to recursive kind
998- -- relations.
999- -- See Note [Mutually recursive representations of primitive types]
1000997putTypeRep rep -- Handle Type specially since it's so common
1001998 | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type )
1002999 = put (0 :: Word8 )
@@ -1008,10 +1005,17 @@ putTypeRep (App f x) = do
10081005 put (2 :: Word8 )
10091006 putTypeRep f
10101007 putTypeRep x
1008+ #if __GLASGOW_HASKELL__ < 903
1009+ -- N.B. This pattern never matches,
1010+ -- even on versions of GHC older than 9.3:
1011+ -- a `Fun` typerep will match with the `App` pattern.
1012+ -- This match is kept solely for pattern-match warnings,
1013+ -- which are incorrect on GHC prior to 9.3.
10111014putTypeRep (Fun arg res) = do
10121015 put (3 :: Word8 )
10131016 putTypeRep arg
10141017 putTypeRep res
1018+ #endif
10151019
10161020getSomeTypeRep :: Get SomeTypeRep
10171021getSomeTypeRep = do
@@ -1039,14 +1043,6 @@ getSomeTypeRep = do
10391043 [ " Applied type: " ++ show f
10401044 , " To argument: " ++ show x
10411045 ]
1042- 3 -> do SomeTypeRep arg <- getSomeTypeRep
1043- SomeTypeRep res <- getSomeTypeRep
1044- case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type ) of
1045- Just HRefl ->
1046- case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type ) of
1047- Just HRefl -> return $ SomeTypeRep $ Fun arg res
1048- Nothing -> failure " Kind mismatch" []
1049- Nothing -> failure " Kind mismatch" []
10501046 _ -> failure " Invalid SomeTypeRep" []
10511047 where
10521048 failure description info =
0 commit comments