alanz / ghc-exactprint

GHC version of haskell-src-exts exactPrint
BSD 3-Clause "New" or "Revised" License
70 stars 32 forks source link

exactPrinted comments seem to gain additional carriage returns on Windows #89

Open jrp2014 opened 4 years ago

jrp2014 commented 4 years ago

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:

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.