On Thu, Sep 02, 2004 at 04:38:39PM +0100, Thorsten Altenkirch wrote:
> >
> >Why won't length type check? the 'n' is on a yellow background.
> 
> Because there is no n on the left hand side, hence the variable is not 
> bound.

Surely there is an n on the left hand side, inside the type of v?
Certainly horace gives me that impression : when you enter the above
interactively, if you have your cursor inside the shed at "length v
[]", Horace says:

n : Nat ; X : * ; v : vec n X |- length v : Nat

which made me feel that 'n' was in scope.

> 
> I believe you can write
> 
> length _n v => n

Yes, that works. Thank you.

> 
> BUT I don't understand why you would want to define a function like that, 
> the n is
> already in the type of v, hence you know the answer already statically.

Perhaps I have some polymorphic function on containers which requires
me to pass in a container and the appropriate length function. Or
perhaps I don't currently grok dependent types enough and this is in
fact totally unecessary :)

Thanks for your answers,

Jules

Reply via email to