if-them_else

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Wed Nov 21 10:31:31 EST 2007


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


More information about the Glasgow-haskell-users mailing list