
Dear GHC developers, when compiling the function f x = if x them False else True ghc-8.8.1 reports: " parse error on input `else' ". When there is a large expession after `them', it is sometimes difficult to locate a typo. Why does not it report " parsing if-then-else: cannot find `then' " ? Regards, ----------------- Serge Mechveliani mechvel@botik.ru

Maybe it's from Chicago and doesn't see anything wrong with "them" in that context. :) -----Original Message----- From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of Serge D. Mechveliani Sent: Wednesday, November 21, 2007 9:04 AM To: glasgow-haskell-users@haskell.org Subject: if-them_else Dear GHC developers, when compiling the function f x = if x them False else True ghc-8.8.1 reports: " parse error on input `else' ". When there is a large expession after `them', it is sometimes difficult to locate a typo. Why does not it report " parsing if-then-else: cannot find `then' " ? Regards, ----------------- Serge Mechveliani mechvel@botik.ru _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Am Mittwoch, 21. November 2007 15:03 schrieb Serge D. Mechveliani:
Dear GHC developers,
when compiling the function f x = if x them False else True
ghc-8.8.1 reports: " parse error on input `else' ".
When there is a large expession after `them', it is sometimes difficult to locate a typo. Why does not it report " parsing if-then-else: cannot find `then' " ?
Regards,
them is a perfect identifier. So probably x them False gets parsed as an expression (x applied to them and the result applied to False). Haskell’s lightweight syntax makes programs short and easy to read (in my opinion) but it often makes the compiler unable to guess where your mistake lies. Best wishes, Wolfgang

-----Original Message----- From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of Wolfgang Jeltsch Sent: Wednesday, November 21, 2007 10:32 AM To: glasgow-haskell-users@haskell.org Subject: Re: if-them_else Am Mittwoch, 21. November 2007 15:03 schrieb Serge D. Mechveliani:
Dear GHC developers,
when compiling the function f x = if x them False else True
ghc-8.8.1 reports: " parse error on input `else' ".
When there is a large expession after `them', it is sometimes difficult to locate a typo. Why does not it report " parsing if-then-else: cannot find `then' " ?
Regards,
them is a perfect identifier. So probably x them False gets parsed as an expression (x applied to them and the result applied to False). Haskell’s lightweight syntax makes programs short and easy to read (in my opinion) but it often makes the compiler unable to guess where your mistake lies. That means that the compiler does not know about the error at the time the "them" token is parsed. It doesn't imply that the error message cannot be better. In this case, since the compiler, indeed, detects the error at the token "else", it should be straightforward to improve the error message. Now, whether it is worth the effort is a separate question, and a judgement call, but it is surely possible and not even terribly difficult. Seth Kurtzberg Software Engineer Specializing in Security, Reliability, and the Hardware/Software Interface Best wishes, Wolfgang _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (3)
-
Serge D. Mechveliani
-
Seth Kurtzberg
-
Wolfgang Jeltsch