purescript / purescript-prelude

The PureScript Prelude

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test code using AlmostEff is subject to dead code elimination

anttih opened this issue · comments

The type

type AlmostEff = Unit -> Unit

causes code that uses it to be removed when compiling using the backend-optimizer. This is problematic when implementing a new backend where the backend-optimizer is of great benefit.

I suggest we replace the use of AlmostEff with just enough Effect to prevent this from happening.

Even if not using the backend-optimizer or somehow making it possible to prevent dead code elimination I think it would still be better not to use Unit -> Unit as the type in the tests.

I should clarify, it's that the backend-optimizer sees Unit -> Unit as a pure function and any bind seems to be doing nothing.