I tried to sort a large list (10,000 elements) in Ellie and I got an exception Uncaught RangeError: Maximum call stack size exceeded:
https://ellie-app.com/3gSGSzwjhZ4a1
According to some members on the Elm forum, the issue might be related to the Debugger, which Ellie is using internally. I'm fairly new to Elm so I'm taking their word and posting the issue here; please let me know if it makes sense to report this in a different repo. Thanks!
I'm getting a similar problem with a much smaller Array. I remember there was a problem in 0.18 with Arrays and I was directed to a third-party, pure-Elm Array implementation as it was a known issue.
That library lives here https://package.elm-lang.org/packages/Skinney/elm-array-exploration/2.0.5
EDIT: sorry, it's not pure Elm, but has less native codez than the official Array implementation.
@Pilatch That library has become the official implementation in Elm 0.19.
@svileng your code works for me.
If this was written in Elm 0.18, then that compiler had issues with large List literals (chrome doesn't handle them to well). This has been fixed in 0.19.
@Skinney I've only seen this exception on Ellie, which I thought is on 0.19. Originally I thought this is an issue in the app, but people recommended me to post this in core.
I'm happy to open an issue in the Ellie repo if that's where it should belong?
Ellie should be on 0.19. It could just be that you have a huge data structure. As said, the code doesn't trigger any exceptions for me.
Could you please clarify what do you mean when you say "the code doesn't trigger any exceptions for me" — do you mean that it works okay locally? Or clicking on the sort button on https://ellie-app.com/3gSGSzwjhZ4a1 doesn't produce any exception for you?
Clicking the sort button on ellie doesn't throw any exception. Running Safari 12.
Thanks for clarifying.
For the record, it still happens for me — running Chrome 69.0.3497.100 (MacOS).
There also is an issue with small arrays in elm-test, but that's probably specific to elm-test or node or something. I'll have to get to a simple reproduction of that later. Just making a note here in case anyone already knows about it.
I am able to reproduce the problem in Chrome Version 69.0.3497.100 (Official Build) (64-bit)

Can confirm that this does not happen locally, using elm reactor.

...And elm-test version 0.19.0-beta9 does just fine until you try to sort 10,000,000 items, at which point I get JavaScript heap out of memory.
It sounds like the root here is that allocating a lot of data can cause problems in certain systems. Given that allocating less is nice in any context, I do not think it makes sense to track this general goal with this particular issue.
Most helpful comment
It sounds like the root here is that allocating a lot of data can cause problems in certain systems. Given that allocating less is nice in any context, I do not think it makes sense to track this general goal with this particular issue.