MultilineStrings and CRLF
Summary
The Proposal for MultilineStrings doesn't mention how sources with CRLF (\r\n
) line endings are handled.
I expected CRLF would be converted to LF (\n
) when reading the source file, but the current implementation does not do so.
Steps to reproduce
Save the following file with CRLF line endings:
{-# LANGUAGE MultilineStrings #-}
str1 = unlines
[ "aaa"
, "bbb"
, "ccc"
]
str2 = "aaa\n\
\bbb\n\
\ccc\n"
str3 = """
aaa
bbb
ccc
"""
str4 = """
aaa
bbb
ccc
"""
str5 = """
aaa
bbb
ccc\n
"""
main = do
print str1
print str2
print str3
print str4
print str5
$ runghc multilinetest.hs
"aaa\nbbb\nccc\n"
"aaa\nbbb\nccc\n"
"\r\naaa\r\nbbb\r\nccc\r"
"\r\naaa\r\nbbb\r\nccc\r\n"
"\r\naaa\r\nbbb\r\nccc\n\r"
Note that the initial newline is not ignored.
Expected behavior
$ runghc multilinetest.hs
"aaa\nbbb\nccc\n"
"aaa\nbbb\nccc\n"
"aaa\nbbb\nccc"
"aaa\nbbb\nccc\n"
"aaa\nbbb\nccc\n"
Environment
- GHC version used: 9.12 (362afd63)
- Operating System: Linux and Windows
- System Architecture: x86_64