Re: type-directed programming

From: Claus Reinke <claus.reinke_at_talk21.com>
Date: Fri, 15 Dec 2006 15:28:46 +0000

> Variables must have monomorphic types in Curry. Without this restriction
> you could define an unsafe cast function

okay, that is understandable. this problem is shared wherever polymorphic
types meet variables that are instantiated away from their definition site
(which therefore cannot be handled as a normal let-binding), so ML and
Haskell have similar issues and restrictions.

> In principle, it would be possible to assign a polymorphic type to
> a variable that is bound to undefined or to a constant like the empty
> list. However, in order to get this right in general, you have to
> perform a groundness analysis. I do not think that it is worth
> complicating the type checker in that way for the few places where
> polymorphic variable might be useful.

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?

Claus


_______________________________________________
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:55 CET

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