I’m really trying to read all your comments as considerate, nice, and constructive, but your confrontational writing style makes it hard sometimes. Remember that this is conversation about the language we both care about, Haskell :), not about winning an argument on the internet.
Your solution to the example is the standard Haskell approach, but it has some drawbacks (whether this warrants a new language extension is up for discussion).
First, it introduces a typeclass without any laws attached and with multiple solutions, many structures can be printed in different ways. Also pretty can not change type between the usages. Say I wanted to be able to colorize V3: pretty:: Color -> V3 -> Text
, I would have to provide the same interface for V2, even if it is never used.
Second, I has to differentiate constructors. Mk2
and Mk3
this creates antipatterns
like newtype MyCoolType = MkMyCoolType { unMyCoolType :: Int }
, which is clearly nicer when written newtype MyCoolType = Mk { un :: Int}
.
Third this suffix anti pattern, makes it very hard to do good code suggestions in an editor.
Typing in Mk
would report { Mk2, Mk3, ... MkMyCoolType}
, typing in V3:
would suggest {V3:Mk, V3:pretty}
which is better.
It’s not and it does not have to :), my proposal is very incremental adding as few features as possible.
I’m not completely sure I get the problem. The goal of the proposal is that ultimately most imports are qualitated (or named), hopefully you would only include your prelude unqualified.
I really do not like using CPP unless I have to; It’s much better to use language features so the the syntax of the language captures the intent of the programmer. This also makes tooling a lot easier.