Skip to content

Commit

Permalink
[ fix agda#310 ] compile Sigma pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
flupe authored and jespercockx committed Apr 12, 2024
1 parent 4e66970 commit 1ddeb68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Agda2Hs/Compile/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ isSpecialCon qn = case prettyShow qn of
"Haskell.Prim.Tuple._,_" -> Just tuplePat
"Haskell.Prim.Tuple._×_×_._,_,_" -> Just tuplePat
"Haskell.Extra.Erase.Erased" -> Just tuplePat
"Haskell.Extra.Sigma._,_" -> Just tuplePat
"Agda.Builtin.Int.Int.pos" -> Just posIntPat
"Agda.Builtin.Int.Int.negsuc" -> Just negSucIntPat
_ -> Nothing
Expand Down
5 changes: 5 additions & 0 deletions test/Tuples.agda
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ t4 : Σ[ n ∈ Nat ] (Dec (IsTrue (n <= 5)))
t4 = 3 S., (True ⟨ itsTrue ⟩)

{-# COMPILE AGDA2HS t4 #-}

t5 : Σ[ x ∈ a ] b a
t5 p = case p of λ where (x S., y) x

{-# COMPILE AGDA2HS t5 #-}
5 changes: 5 additions & 0 deletions test/golden/Tuples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ test2
t4 :: (Natural, Bool)
t4 = (3, True)

t5 :: (a, b) -> a
t5 p
= case p of
(x, y) -> x

0 comments on commit 1ddeb68

Please sign in to comment.