hdgarrood / purescript-sequences

Various efficient-ish sequence types for PureScript.
http://pursuit.purescript.org/packages/purescript-sequences
MIT License
45 stars 22 forks source link

Eq implementation is not tail safe #41

Open CGenie opened 1 year ago

CGenie commented 1 year ago

Hello,

This simple code throws an error:

import Prelude
import Data.Array as A
import Data.Sequence as Seq

s = Seq.fromFoldable $ A.range 0 10000
s == s
.psci_modules/Data.FingerTree/index.js:576
var snoc = function (dictMonoid) {
                    ^

RangeError: Maximum call stack size exceeded
    at snoc (.psci_modules/Data.FingerTree/index.js:576:21)
    at snocAll (.psci_modules/Data.FingerTree/index.js:606:17)
    at toFingerTree (.psci_modules/Data.FingerTree/index.js:615:20)
    at deepL (.psci_modules/Data.FingerTree/index.js:646:25)
    at .psci_modules/Data.FingerTree/index.js:637:28
    at .psci_modules/Data.Lazy/foreign.js:6:9
    at Module.force (.psci_modules/Data.Lazy/foreign.js:13:10)
    at .psci_modules/Data.FingerTree/index.js:658:76
    at .psci_modules/Data.FingerTree/index.js:637:112
    at .psci_modules/Data.Lazy/foreign.js:6:9
CGenie commented 1 year ago

Hm, OK, I ran this on bare purescript-sequences and don't get the error, I guess this is somewhere in my project, don't know why though...