Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix stack issue for listT map #18

Merged
merged 1 commit into from
Jun 10, 2019
Merged

fix stack issue for listT map #18

merged 1 commit into from
Jun 10, 2019

Conversation

safareli
Copy link
Contributor

fix #16

@safareli
Copy link
Contributor Author

JS from purescript 0.12 output was this:

var listTFunctor = function (dictMonad) {
    return new Data_Functor.Functor(function (f) {
        return function ($161) {
          var $160 = Control_Monad.liftM1(dictMonad)(bimapTStep(f)(Data_Functor.map(listTFunctor(dictMonad))(f)));
            return ListT($160(stepListT($161)));
        };
    });
};

but on purescript 0.13 output was changed to this:

var listTFunctor = function (dictMonad) {
    return new Data_Functor.Functor(function (f) {
        var $160 = Control_Monad.liftM1(dictMonad)(bimapTStep(f)(Data_Functor.map(listTFunctor(dictMonad))(f)));
        return function ($161) {
            return ListT($160(stepListT($161)));
        };
    });
};
\

With the change from this PR, js output on purescript 0.13 now looks like this:

var listTFunctor = function (dictMonad) {
    return new Data_Functor.Functor(function (f) {
        return function (v) {
            return ListT(Control_Monad.liftM1(dictMonad)(bimapTStep(f)(Data_Functor.map(listTFunctor(dictMonad))(f)))(stepListT(v)));
        };
    });
};


And it fixed the issue.

@safareli safareli merged commit 14eb29f into master Jun 10, 2019
@safareli safareli deleted the fix-ps0-13-map branch June 10, 2019 22:03
@safareli
Copy link
Contributor Author

@safareli
Copy link
Contributor Author

safareli commented Jun 10, 2019

https://github.com/purescript/purescript/releases/tag/v0.13.0 under “Other Changes > Breaking”
Fix sharing in function composition inlining (purescript/purescript#3439). This is really a bugfix, but it has the potential to break code. Previously, you could write recursive point-free compositions that the compiler inadvertently eta-expanded into working code by eliminating sharing. We've changed the optimization to respect strict evaluation semantics, which can cause existing code to stack overflow. This generally arises in instance definitions. Unfortunately, we don't have a way to disallow the problematic code at this time.

@safareli safareli mentioned this pull request Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

RangeError: Maximum call stack size exceeded
1 participant