[GHC] #11117: mdo blocks in error messages are shown modified

GHC ghc-devs at haskell.org
Fri Nov 20 13:32:09 UTC 2015


#11117: mdo blocks in error messages are shown modified
-------------------------------------+-------------------------------------
           Reporter:  nomeata        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  7.8.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE RecursiveDo #-}
 main = mdo
   Just x <- return (Right x)
   return ()
 }}}

 gives

 {{{
 MdoTypeError.hs:3:3:
     Couldn't match expected type ‘Either a0 b0’
                 with actual type ‘Maybe b0’
     Relevant bindings include x :: b0 (bound at MdoTypeError.hs:3:8)
     In the pattern: Just x
     In a stmt of an 'mdo' block: Just x <- return (Right x)
     In a stmt of an 'mdo' block: rec { Just x <- return (Right x) }
 }}}

 Note that the error message mentions `rec` even though that is not what
 the user entered. In other instances, we are careful to show the code more
 similar to the original (e.g. `do`-notation instead of `>>=`). This should
 also be done here.

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


More information about the ghc-tickets mailing list