diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-02-11 20:18:46 -0500 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-02-11 20:18:46 -0500 |
commit | 11082ee77ac7e980680d5ca45df9a84ad55641d2 (patch) | |
tree | 0c1ed6fedf46d8309d4a060931651f67ef7aa7d9 /DepType.idr |
Initial commit.
http://docs.idris-lang.org/en/latest/tutorial/typesfuns.html
Diffstat (limited to 'DepType.idr')
-rw-r--r-- | DepType.idr | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/DepType.idr b/DepType.idr new file mode 100644 index 0000000..54ac7ad --- /dev/null +++ b/DepType.idr @@ -0,0 +1,19 @@ +module DepType + +isSingleton : Bool -> Type +isSingleton True = Nat +isSingleton False = List Nat + +sum : (single : Bool) -> isSingleton single -> Nat +sum True x = x +sum False (x :: xs) = x + sum False xs + +data MyVect : Nat -> Type -> Type where + Nil : MyVect Z a + (::) : a -> MyVect k a -> MyVect (S k) a + +(++) : MyVect k a -> MyVect l a -> MyVect (k + l) a +(++) [] ys = ys +(++) (x :: xs) ys = x :: xs ++ ys + +-- The finite sets. |