Skip to content

Instantly share code, notes, and snippets.

@appositum
Created January 8, 2019 16:40
Show Gist options
  • Save appositum/85d15d2f04ba4b06cefb1c3ad8258810 to your computer and use it in GitHub Desktop.
Save appositum/85d15d2f04ba4b06cefb1c3ad8258810 to your computer and use it in GitHub Desktop.
infixr 5 :>
data Vect : Nat -> Type -> Type where
Empty : Vect Z a
(:>) : a -> Vect n a -> Vect (S n) a
data Sigma : (a : Type) -> (P : a -> Type) -> Type where
MkSigma : {P : a -> Type} -> (x : a) -> P x -> Sigma a P
vec : Sigma Nat (\n => Vect n Int)
vec = MkSigma 2 (3:>4:>Empty)
vec' : Sigma Nat (\n => Vect n Int)
vec' = MkSigma _ (3:>4:>Empty)
len : Vect n a -> Sigma Nat (\m => n = m)
len {n} _ = MkSigma (S n) Refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment