-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
Description
It looks like there is no way to annotate with colors when implement Pretty instance since its functions polymorphic on annotation type.
Consider
newtype Amount = Amount Int
instance Pretty Amount where
pretty (Amount n)
| n < 0 = annotate (colorDull Red) $ pretty n
| otherwise = pretty nIs there any suggestions about migrating in this case?
Suggestion
MultiParamTypeClasses
class Pretty a ann where
pretty :: a -> Doc annThis seems to model pretty better since it is indexed by both what we render and which annotations we want to collect.
In case of simple types we can keep ann unrestricted and allow rendering for any annotation type.