Pretty Printer for textual version of Language (name) in DynFlags
|Reported by:||Fuuzetsu||Owned by:||seraphime|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
Description (last modified by bgamari)
I feel that the GHC API could benefit from a Show instance for Language in DynFlags.hs.
Currently, if we want to display the language being used we have to do something like
foo inf = case hmi_language inf of Nothing -> Nothing Just Haskell98 -> Just "Haskell98" Just Haskell2010 -> Just "Haskell2010"
This is pretty much just the Show instance (over Maybe) and Haskell can derive it for us automatically: we just need to change deriving Enum to deriving (Enum, Show). The above solution is not the most robust ever as if this data type is ever changed, this starts to form an incomplete pattern. If we have a catch all _, GHC complains about overlapping patterns. Easily solved with show <$> hmi_language inf.
Change History (6)
comment:1 Changed 3 years ago by carter
- Summary changed from Show instance for Language in DynFlags to Pretty Printer for textual version of Language (name) in DynFlags
comment:5 Changed 7 days ago by bgamari
- Description modified (diff)
- Milestone set to 8.0.1
- Resolution set to fixed
- Status changed from new to closed