Re: type-directed programming

From: Wolfgang Lux <>
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,
(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
type variables) for all kinds of expressions involving mutable
but Standard ML now has switched to the value restriction, which is
equivalent to Curry's typing discipline.


curry mailing list
Received on So Dez 17 2006 - 14:53:56 CET

This archive was generated by hypermail 2.3.0 : Mo Okt 26 2020 - 07:15:04 CET