Brittany does not currently format type class declarations. Instead it simply passes them through. That's fine for a lot of cases because defining new type classes is less common than adding instances. Also type classes often aren't very complicated syntactically, so it's not too burdensome to format them by hand. All that being said, it would be great if Brittany could format them. For example, consider this type class declaration:
-- brittany --columns 20
class SomeVeryLongConstraint => SomeVeryLongTypeClass someVeryLongTypeName where
someVeryLongMethodName :: someVeryLongTypeName -> someVeryLongTypeName
someVeryLongMethodName someVeryLongVariableName = someVeryLongVariableName
I chose 20 columns arbitrarily in order to force the layout onto multiple lines. Otherwise the result isn't super interesting.
I'm not exactly sure how I'd like that to be formatted, but maybe something like this?
class
SomeVeryLongConstraint
=> SomeVeryLongTypeClass
someVeryLongTypeName
where
someVeryLongMethodName
:: someVeryLongTypeName
-> someVeryLongTypeName
someVeryLongMethodName someVeryLongVariableName
= someVeryLongVariableName
Brittany does not currently format type class declarations. Instead it simply passes them through. That's fine for a lot of cases because defining new type classes is less common than adding instances. Also type classes often aren't very complicated syntactically, so it's not too burdensome to format them by hand. All that being said, it would be great if Brittany could format them. For example, consider this type class declaration:
I chose 20 columns arbitrarily in order to force the layout onto multiple lines. Otherwise the result isn't super interesting.
I'm not exactly sure how I'd like that to be formatted, but maybe something like this?