From ef26fd1d5ff07e15850eadb4b06936c4bcb453b1 Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Fri, 28 Jul 2023 12:02:57 +0200 Subject: [PATCH] Allow matching two empty `KMap`s --- library/Booster/Pattern/Match.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Booster/Pattern/Match.hs b/library/Booster/Pattern/Match.hs index eb2d85708..ea04d9825 100644 --- a/library/Booster/Pattern/Match.hs +++ b/library/Booster/Pattern/Match.hs @@ -269,7 +269,12 @@ match1 -- and, domain values, injections, maps: fail _other -> failWith $ DifferentSymbols app subj --- matching on maps unsupported +----- KMap +-- empty maps match trivially with an empty substitution +match1 + (KMap _ [] Nothing) + (KMap _ [] Nothing) = pure mempty +-- matching on non-empty maps is not supported match1 t1@KMap{} t2 = indeterminate t1 t2