Skip to content

Commit

Permalink
add pattern for 3-uple
Browse files Browse the repository at this point in the history
  • Loading branch information
flupe authored and jespercockx committed Dec 5, 2023
1 parent cc79050 commit ccbe3dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Agda2Hs/Compile/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ import Agda.TypeChecking.Datatypes (isDataOrRecord)

isSpecialPat :: QName -> Maybe (ConHead -> ConPatternInfo -> [NamedArg DeBruijnPattern] -> C (Hs.Pat ()))
isSpecialPat qn = case prettyShow qn of
"Haskell.Prim.Tuple._,_" -> Just tuplePat
"Haskell.Prim.Tuple._,_" -> Just tuplePat
"Haskell.Prim.Tuple._×_×_._,_,_" -> Just tuplePat
"Agda.Builtin.Int.Int.pos" -> Just posIntPat
"Agda.Builtin.Int.Int.negsuc" -> Just negSucIntPat
s | s `elem` badConstructors -> Just $ \ _ _ _ -> genericDocError =<<
Expand Down
7 changes: 7 additions & 0 deletions test/Tuples.agda
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ test : Int
test = let (x , y) = pair in x + y

{-# COMPILE AGDA2HS test #-}

test2 : Bool
test2 = case t1 of \where
(a , b , c) c

{-# COMPILE AGDA2HS test2 #-}

5 changes: 5 additions & 0 deletions test/golden/Tuples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ pair = (1, 2)
test :: Int
test = fst pair + snd pair

test2 :: Bool
test2
= case t1 of
(a, b, c) -> c

0 comments on commit ccbe3dc

Please sign in to comment.