Re: Two to Three Ways to write an unsafe type cast without importing Unsafe

From: Bernd Brassel <bbr_at_informatik.uni-kiel.de>
Date: Fri, 16 May 2008 11:47:01 +0200

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

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:08 CET