Skip to content

mdo blocks in error messages are shown modified

{-# 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.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information