From 4a1350a7835da1c3f13309c685f455bc4265260c Mon Sep 17 00:00:00 2001 From: Paul Cadman Date: Wed, 6 Nov 2024 18:28:38 +0000 Subject: [PATCH] Use `nockmaEq` instead of Eq instance to detect `nil` terminator (#3149) `unfoldList` should work with for lists like: * `[5 0]` * `[5 nil]` * `[5 tag@myNilTag 0]` * etc. currently `unfoldList` will work only for list `nil` terminators that are tagged with `unfoldList`. `nockmaEq` compares nock terms ignoring debug annotations, so the above lists will work correctly. --- src/Juvix/Compiler/Nockma/Language.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Juvix/Compiler/Nockma/Language.hs b/src/Juvix/Compiler/Nockma/Language.hs index a51d115c1..4df90129d 100644 --- a/src/Juvix/Compiler/Nockma/Language.hs +++ b/src/Juvix/Compiler/Nockma/Language.hs @@ -569,7 +569,7 @@ unfoldList = ensureNockmList . nonEmpty . unfoldTuple Nothing -> err Just l -> case l ^. _unsnoc1 of (ini, lst) - | lst == nockNilTagged "unfoldList" -> ini + | nockmaEq lst (nockNilTagged "unfoldList") -> ini | otherwise -> err where err :: x