[GHC] #9367: :list does not underline expression correctly in WinGHCi for files with Windows-style newlines

GHC ghc-devs at haskell.org
Mon Oct 27 19:11:10 UTC 2014


#9367: :list does not underline expression correctly in WinGHCi for files with
Windows-style newlines
---------------------------------------+----------------------------------
              Reporter:  kraai         |            Owner:  gintas
                  Type:  bug           |           Status:  new
              Priority:  normal        |        Milestone:
             Component:  GHCi          |          Version:  7.6.3
            Resolution:                |         Keywords:
      Operating System:  Windows       |     Architecture:  x86_64 (amd64)
       Type of failure:  None/Unknown  |       Difficulty:  Unknown
             Test Case:                |       Blocked By:
              Blocking:                |  Related Tickets:
Differential Revisions:                |
---------------------------------------+----------------------------------
Changes (by gintas):

 * owner:   => gintas


Comment:

 I could reproduce the bug on winghci 1.0.6 bundled with Haskell Platform
 2014.2.0.0 (ghc 7.8.3). The problem does not appear when running ghc from
 an msys terminal or a Windows command shell. However, I looked into it
 more closely and it looks like ghci is indeed at fault. There is some
 funny business going on with line endings. In the part that is the source
 listing, newlines are not <CR><LF>, but <CR><CR><LF>. That's probably
 what's confusing WinGHCI.

 My guess is that something is not stripping the <CR><LF> from the source
 properly and then tries to append <CR><LF> on its own.

 To illustrate, the additional <CR>s show up as ^M:

 a :: Int = 8
 left :: [Int] = _
 right :: [Int] = _
 [C:\users\gintas\temp\qsort.hs:2:16-47] *Main> 1  qsort [] = []^M
 2  qsort (a:as) = qsort left ++ [a] ++ qsort right^M
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 3   where (left,right) = (filter (<=a) as, filter (>a) as)^M
 [C:\users\gintas\temp\qsort.hs:2:16-47] *Main> Leaving GHCi.

 Produced using:
 echo -e ':l qsort.hs \n:b 2\n:main\n:list' | TERM=dumb
 /tmp/ghc/bin/ghc.exe --interactive > /tmp/out

 The issue is still there in ghc HEAD. Let me take a look.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9367#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list