[GHC] #16137: unhelpful parse error message: Unexpected do block in function application

GHC ghc-devs at haskell.org
Sun Jan 6 18:15:18 UTC 2019


#16137: unhelpful parse error message: Unexpected do block in function application
-------------------------------------+-------------------------------------
           Reporter:  j.waldmann     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
  (Parser)                           |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Not a bug, as ghc correctly rejects an invalid program. But I have the
 impression that the error message is getting less precise (for reason and
 location) from 8.4 to 8.6:
 {{{
 foo = do
   let x = case y of
     Nothing -> True
   bar
 }}}
 8.6.3 says
 {{{
 P.hs:1:7: error:
     Unexpected do block in function application:
         do let x = ...
     You could write it with parentheses
     Or perhaps you meant to enable BlockArguments?
   |
 1 | foo = do
   |       ^^...
 }}}
 I am not seeing what application ghc thinks of.

 8.4.4 had the more useful
 {{{
 P.hs:3:5: error: parse error on input ‘Nothing’
   |
 3 |     Nothing -> True
   |     ^^^^^^^
 }}}
 More useful, since in the actual code, from which I distilled the above,
 there were a dozen lines between the locations that were reported by 8.6.3
 and 8.4.4.

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


More information about the ghc-tickets mailing list