Re: type-directed programming

From: Sebastian Fischer <sebf_at_informatik.uni-kiel.de>
Date: Fri, 15 Dec 2006 11:52:56 +0100

Hi Sebastian,

it took me a while to recognize that prec is a primitive recursion
operator because the arguments where swapped in a way that the
definition was not even type correct. You link clarified this point.

> I think that /free variables/ are crucial to this method.

I don't think so. You can replace "where x free" with "where x = _|_"
and Curry will still infer the type for you:

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

undefined = undefined

primrec> :t cursor
cursor :: Nat -> Nat

Interestingly, Haskell does not! If we load this in ghci, we get:

*Main> :t cursor
cursor :: a

Astonishing, but free variables don't seem to play a major role here.

Cheers,
Sebastian

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Dez 15 2006 - 15:05:21 CET

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