Polysemy: Higher-order effects with Final
In a previous log, we introduced Higher-order effects definition and interpretation through tactics.
Some elements from tactics are already deprecated, and my guess is that it will spread until tactics will be completly removed.
According to the documentation strategies should be choosed if possible.
Let's review our effect:
data When (m :: Type -> Type) a where
WhenM :: m () -> When m ()
makeSem ''When
Now we can define the interpreter:
interpretWhenFinal =
interpretFinal @IO $
\case
WhenM act -> runS act
Here are the key differences:
interpretFinalrequired aFinal mto workrunSis a general function (whilerunTSimpleis a special case ofrunT)
See the full the code here.