#2111: Incorrect arrow rec {} notation crashes in ghci
-------------------------+--------------------------------------------------
Reporter: luqui | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.1
Severity: normal | Resolution:
Keywords: | Testcase:
Architecture: x86 | Os: Linux
-------------------------+--------------------------------------------------
Comment (by ross):
The `-farrows` option turns on the `rec` keyword, but then you get this
even without using arrow notation:
{{{
Prelude> do { rec { x <- return ('a':x); }; putStrLn (take 20 x) }
ghc-6.8.2: panic! (the 'impossible' happened)
(GHC version 6.8.2 for i386-unknown-linux):
tcDoStmt: unexpected Stmt
rec {(x{v aon}) <- base:GHC.Base.return{v 01T}
('a' base:GHC.Base.:{(w) d 64} x{v aon})}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}}
but if `do` is replaced with `mdo`, it works:
{{{
Prelude> mdo { rec { x <- return ('a':x); }; putStrLn (take 20 x) }
aaaaaaaaaaaaaaaaaaaa
}}}
This is because tcDoStmt does not handle RecStmt. In the original
example, the correct behaviour would be to object to the use of arrow
application in an expression, as it does with `mdo`:
{{{
Prelude> mdo { rec { x <- undefined -< x }; undefined -< x }
<interactive>:1:17:
The arrow command
undefined -< x
was found where an expression was expected
In an 'mdo' expression: x <- undefined -< x
In an 'mdo' expression: rec {x <- undefined -< x}
In the expression:
mdo rec {x <- undefined -< x}
undefined -< x
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2111#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs