We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d25143d commit 914b99eCopy full SHA for 914b99e
test/CompileTo.agda
@@ -1,5 +1,7 @@
1
2
open import Haskell.Prelude
3
+open import Haskell.Extra.Refinement
4
+open import Haskell.Law.Equality
5
6
private variable
7
@0 n : Nat
@@ -32,13 +34,15 @@ llength (x ∷ xs) = 1 + llength xs
32
34
33
35
{-# COMPILE AGDA2HS llength #-}
36
-vlength : Vec a n → Nat
-vlength [] = 0
37
-vlength (x ∷ xs) = 1 + vlength xs
+vlength : Vec a n → ∃ Nat (_≡ n)
38
+vlength [] = 0 ⟨ refl ⟩
39
+vlength (x ∷ xs) =
40
+ let n ⟨ eq ⟩ = vlength xs
41
+ in (1 + n) ⟨ cong suc eq ⟩
42
43
{-# COMPILE AGDA2HS vlength to llength #-}
44
-test3 : Nat
45
+test3 : ∃ Nat (_≡ 3)
46
test3 = vlength test1
47
48
{-# COMPILE AGDA2HS test3 #-}
0 commit comments