Wolfgang Lux wrote:
> You should be aware that this sort of restriction seriously
> limits the abilities of using logical style definitions in Curry.
> Consider the following innocuous little goal
>
> last [(+), (-), (*)] 7 6
>
> The result of this goal is either 42 or a runtime error depending
> on whether last is defined in a purely functional style
> last [x] = x
> last (_:x:xs) = last (x:xs)
> or with a function pattern
> last (_ ++ [x]) = x
>
> I would be perfectly happy with that difference if it would show
> up in last's type (i.e., by a type class constraint in the type of
> the second definition) so that I get a type error in the first
> place when attempting to evaluate the sample goal with the second
> definition of last.
Yes, I fully agree. And I think that this problem is a very good
argument for your type class extension.
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Mai 16 2008 - 12:48:24 CEST