Re: type-directed programming

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Fri, 15 Dec 2006 17:40:30 +0100

Claus Reinke wrote:

> this might be naive, but wouldn't it be sufficient to limit
> variables, eg
> "free" in Curry, to monomorphic types, and let type inference do the
> rest? in other words "y free" would be monomorphic, "x = .." could
> be polymorphic, but no analysis beyond type inference would be
> needed to propagate the monomorphism of variables to terms
> containing them?
>
> I'm just trying to understand why this naive approach would fail, ie,
> why a groundness analysis would be needed in general?

It is simply because in Curry functions can return unbound variables,
e.g.
(quoted from the Prelude)

   unknown :: a
   unknown = x where x free

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.

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:56 CET

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