Ticket #39 (closed defect: invalid)

Opened 7 years ago

Last modified 7 years ago

Incorrect parsing of lambda expressions

Reported by: Ørjan Johansen Owned by: nobody
Priority: major Milestone:
Component: parsing Version: 200609
Keywords: Cc:

Description

Hugs doesn't seem to allow lambda expressions everywhere it should. Example:

Hugs> let f l = flip map l \a -> a+1 in f [1..10] ERROR - Syntax error in expression (unexpected backslash (lambda))

Change History

Changed 7 years ago by Neil Mitchell

Using GHCi

Prelude> let f l = flip map l \a -> a+1 in f [1..10] <interactive>:1:21: parse error on input `\'

Can you point to a Haskell thingy that gets this "right", or a section of the report that shows the above being correct?

Changed 7 years ago by Ørjan Johansen

What, you are right, the argument of a function is an aexp, while lambdas are exp10s. It just seemed so natural that I assumed it was allowed: for example, without it continuation passing style gets more awkward. Well, now that I understand why it happens, I see that I can get around it with a $.

Changed 7 years ago by guest

  • status changed from new to closed
  • resolution set to invalid
Note: See TracTickets for help on using tickets.