ghc-exactprint
ghc-exactprint copied to clipboard
exactPrinted comments seem to gain additional carriage returns on Windows
ghc-exactprint 0.6.3.1 (ghc-8.10.1) works well on Windows for most code, but it seems to insert extra carriage returns in comments.
For example,
--Another comment
--
newtype N a = Int a
data D a = A a | B | C a
gets turned into:
--Another comment
--
newtype N a = Int a
data D a = A a | B | C a
(there are \r\n
, rather than \n
at the end of each comment line. (Multi-line comments ({-
) also have all their internal newlines replaced by cr+nl.)
There are two solutions:
- get
newline
to push out\r\n
, rather than\n
, under Windows - always replace
\r\n
by\n
within comments
Or you could offer both in different print styles, I suppose, because different people will have different git settings to handle this and golden test case output should be cross-platform.