Re: type-directed programming

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Fri, 15 Dec 2006 22:05:12 +0100

Wolfgang Lux wrote:

> In principle, one could assign a monomorphic type to such functions
> (and thus reject the above definition for having a polymorphic type
> signature), but IMHO this makes such functions considerably less
> useful.
> Incidentally, the situation is similar to ML. In former times,
> Standard
> ML was using imperative type variables (which effectively are
> monomorphic
> type variables) for all kinds of expressions involving mutable
> references,
> but Standard ML now has switched to the value restriction, which is
> equivalent to Curry's typing discipline.

Sorry, I was a little bit too quick here. Curry's typing discipline
is in
fact a bit more restrictive than ML's value restriction. For instance,
Curry assigns a monomorphic type to x in
   let x = [] in (1:x,'a':x)
and therefore rejects the above definition, whereas in ML the equivalent
definition would be accepted. It would be possible to generalize Curry's
type system here and adopt ML's value restriction. However, even in that
case the variables mz and ms in the definition

> cursor = mz
> where
> plus :: Nat -> Nat -> Nat
> plus = prec mz ms
> mz = undefined
> ms = undefined

would remain monomorphic because undefined is syntactically not a value.
Regards
Wolfgang


_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on So Dez 17 2006 - 14:53:59 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:08 CEST