Hi!
I think you're getting a few things mixed up here, in particular the *type*
Fin k (where k is a parameter of type Nat), and a *value* of type Fin k.
On Sun, Feb 28, 2016 at 04:28:30AM -0800, Marko Grdinic wrote:
> t : Fin 2
> t = Fin 2 // Does not work.
You can ask idris why it is faililng!
*test> :t Fin 2
Fin 2 : Type
but what you want is a value of type Fin 2. to do this, you call a
constructor, for example FZ
t : Fin 2
t = FZ
*test> :t t
FZ : Fin 2
This might be confusing, because the parameter k to the constructor FZ is inferred
by idris. In reality the type of FZ is as follows
*test> :set showimplicits
*test> :t FZ
Data.Fin.FZ : {k : Prelude.Nat.Nat} ->
Data.Fin.Fin (Prelude.Nat.S k)
So FZ can construct values of any type Fin (S k). (Bonus question: Why is it
(S k) not just k?).
The constructor FS is similar. Also try
t = FS (FS (FS FZ))
Cheers,
Markus
> --
> You received this message because you are subscribed to the Google Groups
> "Idris Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to
idris-lang+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.