I use shake but the operations I call are in an ErrIO and not in the IO monad. How can I lift such operations into the Action
monad. I could runErr
and get and Either
value and then call throwIO
or liftIO
(depending on the result). Is this the recommended approach?
The code could be like:
runErr2action :: ErrIO a -> Action a
runErr2action op = liftIO $ do
res <- runErr op
case res of
Left msg -> throw msg
Right a -> return a
Perhaps connected question: Why is there no instance of MonadError
for Action
?