Description
The compiler misses an opportunity for tail-call optimization when the self call happens inside a case clause guarded with assign (<-) expression.
To Reproduce
Compile module
module Test where
fixPokemonHp :: Int -> Int
fixPokemonHp x = case x of
n | _ <- n -> fixPokemonHp x
_ -> fixPokemonHp x
Expected behavior
Produce some tail recursive code
Actual behavior
// Generated by purs version 0.13.8
"use strict";
var fixPokemonHp = function (x) {
var v = function (v1) {
return fixPokemonHp(x);
};
return fixPokemonHp(x);
};
module.exports = {
fixPokemonHp: fixPokemonHp
};
Additional context
btw I am using Arch Linux
Add any other context about the problem here.
PureScript version
0.13.8