Here's self-containing example:
data MyEffect r where
Execute :: MyEffect ()
makeEffect ''MyEffect
handleFirstEffect :: (LastMember IO effs) => MyEffect ~> Eff effs
handleFirstEffect = \case
Execute -> liftIO $ print "handleFirstEffect"
handleSecondEffect :: (LastMember IO effs) => MyEffect ~> Eff effs
handleSecondEffect = \case
Execute -> liftIO $ print "handleSecondEffect"
main :: IO ()
main = do
runM
$ interpret handleSecondEffect
$ interpose handleFirstEffect execute
The programs prints only handleFirstSecond, but does not print handleSecondEffect. I would have expected to also print the latter, since interpose should allow someone to respond to the effect while leaving it unhandled.
Bug or is there's something I'm not understanding?