Poor pretty-printing for unsaturated unboxed sums
GHC runs aground when printing unsaturated unboxed sums.
Unsaturated unboxed sums are hard to even access, because GHC does not parse them. But that never stops an intrepid explorer.
type GetFunKind :: k -> Type
type family GetFunKind x where
forall arg_k res_k (a :: arg_k -> res_k) (b :: arg_k). GetFunKind (a b) = arg_k -> res_k
type GetFun :: forall res_k. forall (x :: res_k) -> GetFunKind x
type family GetFun x where
GetFun (a b) = a
rae:09:29:51 ~/temp> ghci -ignore-dot-ghci
GHCi, version 9.2.1: https://www.haskell.org/ghc/ :? for help
ghci> :set -XUnboxedTuples -XUnboxedSums -XMagicHash -fprint-explicit-runtime-reps
ghci> import GHC.Exts
ghci> :load Scratch.hs
[1 of 1] Compiling Scratch ( Scratch.hs, interpreted )
Ok, one module loaded.
ghci> :kind! GetFun (# Int#, Double# #)
GetFun (# Int#, Double# #) :: GetFunKind (# Int#, Double# #)
= (#,#) Int#
ghci> :kind! GetFun (# Int# | Double# #)
GetFun (# Int# | Double# #) :: GetFunKind (# Int# | Double# #)
= (# 'DoubleRep | Int# #)
ghci> :kind! GetFun (GetFun (# Int# | Double# #))
GetFun (GetFun (# Int# | Double# #)) :: GetFunKind
(GetFun (# Int# | Double# #))
= (# 'DoubleRep #)
ghci>
Note the (# 'DoubleRep | Int# #)
and (# 'DoubleRep #)
lines, which are wrong.