Skip to content

Reverse do notation: lexer bug?

Noticed here:

http://calculist.blogspot.com/2007/07/cute-idiom-from-haskell.html

The following is accepted by GHC:

main = do
    getChar -> c
    print c

Yielding the same program as if we'd written;

main = do
    c <- getChar
    print c

The above blogger uses this to ingeniously embed:

gamma |- e -> v

in Haskell, but surely this is either a lexer bug, or an interesting syntactic feature that shouldn't be enabled by default?

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC dons@cse.unsw.edu.au
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information