plutus
plutus copied to clipboard
Fix `isEssentiallyWorkFree`
UntypedPlutusCore.Transform.FloatDelay.isEssentiallyWorkFree doesn't make any sense:
isEssentiallyWorkFree :: Term name uni fun a -> Bool
isEssentiallyWorkFree = \case
LamAbs{} -> True
Constant{} -> True
Delay{} -> True
Constr{} -> True
Builtin{} -> True
Var{} -> False
Force{} -> False
-- Unsaturated builtin applications should also be essentially work-free,
-- but this is currently not implemented for UPLC.
-- `UntypedPlutusCore.Transform.Inline.isPure` has the same problem.
Apply{} -> False
Case{} -> False
Error{} -> False
Why do we consider any Constr node to be essentially work-free if it may literally contain arbitrary computations?
And unsaturated builtin applications should get better treatment, as per the comment (I don't think the part about isPure is correct though, but not sure).
This issue is for fixing all of that, most likely simply by moving to isWorkFree.
I like the name of this function.