Enable "rec" keyword when RecursiveDo is enabled?
GHC supports recursive statement groups marked by the keyword rec
, however this is only activated via a hack. Consider this (silly) example program:
{-# LANGUAGE RecursiveDo, Arrows #-}
main :: IO ()
main =
mdo x <- return (length [1..42::Int])
rec b <- return x
let a = const c
c <- print "x"
return (a b)
The Arrow
language needs to be enabled, otherwise the rec
keyword wouldn't be recognised. Currently this behaviour is undocumented, and rec
groups only appear in the internal AST.
This ticket has been created to have a documented decsion whether this feature is supported or not. Given that GHC automatically identifies strongly-connected components and re-groups things (although it cannot re-order statements due to probable dependencies) having an explicet rec
keyword probably isn't that useful. In particular
mdo foo ...is equivalent to... mdo rec foo
bar bar
baz baz
Thoughts?
Trac metadata
Trac field | Value |
---|---|
Version | 6.11 |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |