Re: cannot define operators

From: Wolfgang Jeltsch <wolfgang_at_cs.ioc.ee>
Date: Wed, 24 Apr 2013 13:04:29 +0300

Am Mittwoch, den 24.04.2013, 09:36 +0200 schrieb Björn Peemöller:
> Am 23.04.2013 18:42, schrieb Wolfgang Jeltsch:
> > Hello,
> >
> > the following code is not accepted by KiCS2:
> >
> >> (-->) :: Int -> Int -> Bool
> >> n --> m = n <= m
> >
> > It is valid Haskell at least, but KiCS2 says:
> >
> >> Bug.curry, line 2.1:
> >> operator symbol expected
> >
> > Is this a bug?
>
> Hello Wolfgang,
>
> in Curry [^1] line comments start with "--", in contrast to Haskell
> where they start with "--{-} ". Therefore, striping of the comments, the
> remaining code is
>
> (
> n
>
> Because of the opening parenthesis, the frontend now expects an operator
> symbol.
>
> [^1]: Defined on p. 67 of the Curry Report 0.8.3.

Hello Björn,

thanks for the explanation. I hope it’s okay that I reply to the list.

What do you mean by “--{-}”? As far as I know, the point with Haskell is
that tokenization is done before stripping comments, so that --> is not
treated as the start of a comment, since the -- is not a token on its
own, but part of the token -->.

> The quick fix is of course to simply change the operator name, but one
> could also ask the question why Curry has a different line comment syntax.

Indeed. :-)

Actually, I would suspect that people who come from logic programming
might want to use an operator like --> at some point.

> Regards,
> Björn

Best wishes,
Wolfgang

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Wed Apr 24 2013 - 15:46:54 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 18 2019 - 07:15:09 CEST