I have a simpler problem also:

------------------------------------------------------------------------------
( n : Nat !
data (---------! where zero : Nat ; !-------------!
! Nat : * ) ! suc n : Nat )
------------------------------------------------------------------------------
( n : Nat ; X : * ! ( x : X ; xs : vec n X !
data !------------------! where (--------------! ; !-----------------------!
! vec n X : * ) ! nil : ! ! cons x xs : !
! vec zero X ) ! vec (suc n) X )
------------------------------------------------------------------------------
( n : Nat ; X : * ; v : vec n X ! let !---------------------------------! ; length v => n
! length v : Nat ) ------------------------------------------------------------------------------


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.

I believe you can write

length _n v => n

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.

--
Dr. Thorsten Altenkirch            phone : (+44) (0)115 84 66516
Lecturer                           http://www.cs.nott.ac.uk/~txa/
School of Computer Science & IT        University of Nottingham

This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks.  Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



Reply via email to