[GHC] #11215: Line endings in quasiquotations are not normalised
GHC
ghc-devs at haskell.org
Sun Dec 13 22:53:11 UTC 2015
#11215: Line endings in quasiquotations are not normalised
-------------------------------------+-------------------------------------
Reporter: refold | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
(Parser) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect result
Unknown/Multiple | at runtime
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Consider the following [http://hackage.haskell.org/package/raw-strings-qq
simple quasiquoter]:
{{{#!hs
foo = QuasiQuoter {
quoteExp = return . LitE . StringL
[...]
}}}
When used like this:
{{{#!hs
bar :: String
bar = [foo|FOO
BAR
BAZ|]
}}}
the string `bar` will contain either LF or CRLF line endings depending on
which convention is used in the file.
This is consistent with documentation, if a bit surprising. However, the
problem is that version control systems (e.g. Git) usually store text
files using Unix line endings, but allow checking them out in a platform-
specific format. So this behaviour gives rise to subtle semantics changes
in the compiled program that depend on the user's VCS settings. Therefore
IMO it makes sense to always normalise CRLF to LF in quasiquotations.
Originally reported [https://github.com/23Skidoo/raw-strings-qq/issues/1
here], a test case can be found [https://github.com/23Skidoo/raw-strings-
qq/blob/master/test/Test.hs here].
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11215>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list