1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-04 05:33:27 +03:00

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.
This commit is contained in:
Paul Cadman 2024-11-06 18:28:38 +00:00 committed by GitHub
parent 1a8b632463
commit 4a1350a783
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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