
Looking at the ​Haskell Prime wiki entry for Recursive Do, this seems to be the relevant bit: That is, a variable used before it is bound is
#15034: Desugaring `mdo` moves a `let` where it shouldn't be -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): treated as recursively defined, while in a Haskell 98 do-statement it would be treated as shadowed. So it looks as if GHC is following the specification. Are you proposing a different specification? And if so, what is it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15034#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler