faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

fay-base Prelude when - change action argument (Fay a) to (Fay ()); #423 #428

Closed ryachza closed 9 years ago

bergmark commented 9 years ago

Does this solve #423? If so I would be thankful for a test case.

ryachza commented 9 years ago

It appears to for me. I will look into adding a test case.

Would you happen to have any pointers regarding formally testing for potentially implementation specific properties like this? The maximum recursion depth would be expected to vary and the triggered depth would not be guaranteed to map to the number of iterations specified. The example provided in #423 is based on time and can vary wildly so I would be looking for a fixed number of iterations.

bergmark commented 9 years ago

That's a very good question, I don't know the answer unfortunately.

What came to mind was using seq and unsafePerformFay somehow... but I might be blowing smoke?

If we can't think of a proper solution; if we can verify that the test case in #423 fails before this commit and passes after consistently, that would still be better than having no test case :-)

ryachza commented 9 years ago

unsafePerformFay is an interesting proposition. Perhaps it could be used inside the action to detect that it's called recursively. I will go that route first and fall back on some high number of iterations.

bergmark commented 9 years ago

Thanks a lot!

I'll make release next week with this included.