Opened 7 years ago

Closed 15 months ago

#1555 closed feature request (wontfix)

Reverse do notation: lexer bug?

Reported by: dons Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 6.6.1
Keywords: Cc: dons@…, dherman@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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?

Change History (11)

comment:1 Changed 7 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

I'm not quite sure how that sneaked in, but it seems to be my fault and I've now removed it.

comment:2 Changed 6 years ago by dherman

Would it be possible to revisit this decision? It's really a nice notation for interpreters (rho |- expr -> value) and type checkers that annotate their results (Gamma |- expr ::: type -> expr'). Don suggested an opt-in compiler flag or pragma. That would be fine with me.

comment:3 Changed 6 years ago by dherman

  • Cc dherman@… added

comment:4 Changed 6 years ago by simonmar

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Type changed from bug to feature request

comment:5 Changed 6 years ago by igloo

Note that similar syntax is now used by the view patterns extension, which might add confusion.

comment:6 Changed 6 years ago by igloo

  • Milestone set to _|_

comment:7 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:8 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:9 Changed 4 years ago by simonmar

  • Difficulty changed from Easy (1 hr) to Easy (less than 1 hour)

comment:10 Changed 15 months ago by morabbin

  • Type of failure set to None/Unknown

Bump; what's the dealio?

comment:11 Changed 15 months ago by simonmar

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.