pure-c/purec

RangeError: Maximum call stack size exceeded

Lupino opened this issue · 11 comments

Likely lack of tco which i am battling through atm

Sorry I responded a bit to hastely from my phone this morning. Upon second reading it would seem you are experiencing the issue during compilation, meaning that we overflow stack while compiling. If you have pure-c checked out, you mind trying running the AST.everywhereM and AST.everythingM traversal functions through runTrampoline? That would be the easiest win, otherwise maybe time has come to invest time to make these functions tail recursive.

more then 200 line will raise an RangeError

screen shot 2018-10-20 at 6 37 31 pm

also raise a RangeError on compile Test/Data/Array.purs

Hm I can successfully compile it over here and run the purescript-arrays test suite. Are you able to identify whereabouts the problem is occurring?

Have you tried using latest master?

It is my mistake, now I can success compile the source。 I only update my macos version,and reinstall nodejs

Now it raise a range error, when I commit line

screenshot 2018-10-21 at 8 32 09 am

and recompile (just run make)

I find RangeError will occur on recompile

make clean
make         # this compile will fine.

#  edit the test/Test/Data/Array.purs 
make         # this time raise an RangeError

I can reproduce this but cannot explain why this is happening. It appears the stack overflow occurs trying to parse the corefn for these large modules. It's a riddle to me, however, why it would work after make clean and only fail subsequently.

So, running the corefn parsing through trampoline solves the issue. However, it's currently not possible to evaluate F to any other monad than Identity. I've submitted a pull request to purescript-foreign that recovers this ability: purescript/purescript-foreign#74. We'll have to see if it gets merged or not. For now, I simply changed the definition of ExceptT to use Trampoline in my local bower_components.... pretty messy.