Re: type-directed programming

From: Sebastian Fischer <>
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
   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.


curry mailing list
Received on Fr Dez 15 2006 - 15:05:21 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:08 CEST