Skip to content

Instantly share code, notes, and snippets.

@exterm
Created March 6, 2013 21:33
Show Gist options
  • Save exterm/5103282 to your computer and use it in GitHub Desktop.
Save exterm/5103282 to your computer and use it in GitHub Desktop.
Example for Dependent Types in Agda
data Vec (A : Set) : Nat -> Set where
[] : Vec A zero
_::_ : {n : Nat} -> A -> Vec A n -> Vec A (succ n)
head : {A : Set} {n : Nat} -> Vec A (succ n) -> A
head (x :: _) = x
zip : {A B : Set} {n : Nat} -> Vec A n -> Vec B n -> Vec (A X B) n
zip [] [] = []
zip (x :: xs) (y :: ys) = < x , y > :: zip xs ys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment