Polysemy: Higher-order effects with FinalGautier DI FOLCO January 15, 2023 [Haskell] #haskell #polysemy #design #effects systems
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:
= interpretFinal @IO $ \case WhenM act -> runS act interpretWhenFinal
Here are the key differences:
Final mto work
runSis a general function (while
runTSimpleis a special case of
See the full the code here.