[Haskell-beginners] MonadThrow, MonadReader and shake

Francesco Ariis fa-ml at ariis.it
Thu Dec 13 10:45:40 UTC 2018

Hello Frédéric,

On Thu, Dec 13, 2018 at 09:15:41AM +0000, PICCA Frederic-Emmanuel wrote:
> Hello,
> I try to write this sort of code
> [...]
> but when I try to compile this I get this error.
> How can I teach ghc how to solve this issue ?


> src/XdsMe.hs:211:22-43: error:
>     • Could not deduce (MonadThrow Action)
>         arising from a use of ‘toRuchePath’

Must has to mean that *inside* the do block starting with

    toFilePath uploaded %> \_out -> do

`MonadThrow` does not work. I stress inside vs. outside because
the outermost `do` block is of type `ReaderT Beamline IO ()`
(which *is* an instance of `MonadThrow`), while `Action`
apparently is not. I can think of two solutions:

    - Make `Action` an instance of `MonadThrow`
    - Let the throw happen outside that `do` block

Let us know if that helped

More information about the Beginners mailing list