Re: Proposal for syntax changes in Curry

From: Wolfgang Lux <lux_at_helios.uni-muenster.de>
Date: Fri, 23 Oct 1998 15:26:27 +0100

Sven Panne wrote:
> [...]
> With free variables in guards (or non-deterministicv functions) you get
> this non-local behaviour even with the old syntax, e.g.:
>
> foo eval flex
> foo 1 = {}
> foo 9 = {}
>
> f x | { foo _y } = _y <= 2
>
> g x = x == 1
>
> h x | f x = 1
> | g x = 2
>
> I don't think that determinism is a local property.

But the semantics clearly indicate the sources of non-determinism. In
your example the non-determinism stems from the overlapping rules in
the definition of foo. In my example, nothing is non-deterministic in
the definition of
  g x = x =:= 1
itself. The whole program becomes non-deterministic however, due to the
(IMHO totally unrelated) *change of semantics* in the function h.

> But with my typing suggestion, an errot should be raised, too:
>
> f x :: Bool
> g x :: Constraint
>
> and Bool is not unifiable with Constraint. It's important to promote
> the Bool to Constraint *after* typechecking.

Yes, you are right. I think your proposal is the way to go.

Regards
Wolfgang

--
Wolfgang Lux				  Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
Universitaet Muenster		Email: lux_at_helios.uni-muenster.de
Received on Fr Okt 23 1998 - 16:35:00 CEST

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