Ticket #288 (new defect)

Opened 3 years ago

Suboptimal display of poly-kinded data family instances involving type variables

Reported by: haasn Owned by:
Priority: minor Milestone:
Version: 2.14.1 Keywords:


Example source code: (language extensions not included)

data Z = ZA | ZB
data family Bat (t :: k) :: *

data instance Bat (z :: Z) where
  A :: Bat ZA
  B :: Bat ZB

This currently gets displayed like:

data Bat Z where
  A :: Bat Z ZA
  B :: Bat Z ZB

Notably, the type parameter ‘z’ is absent. I tried updating the synifyFamInst code but it seems like the ‘z’ is not actually present anywhere, at least I could not see it in either fi_tvs or fi_tys. Maybe ask GHC devs about this?

Anyway, it's not a major issue since it's clear from the constructors what kind the data instance is for.

Note: The ‘Z’ everywhere is not a regular type parameter but rather a kind parameter. We may wish to hide these altogether or display them in a different style (like italic) to prevent possible confusion in general. I'm reluctant to remove them completely since they do carry valuable information sometimes, but to stay consistent with the behavior of GHC 7.8+ as well as Haskell source code it may be wise to distinguish them from regular type application.

Note: See TracTickets for help on using tickets.