Using the ExceptT monad with different error types

185 views Asked by At

I decided to refactor this code https://github.com/kototama/screepy/blob/21b5b12bc16f9c4e5ee699ca319fd6c6466d1421/src/Screepy/Auth.hs which deals with IO, Either and Maybe values with an ExceptT monad.

Here is my refactored code: https://github.com/kototama/screepy/blob/dc2dcf5abfd72e29dd018c4a7377a02a1fa097a9/src/Screepy/Auth.hs

This does not seem much of an improvement to me. What can I do to improve this code?

And in general how to deal with code calling libraries that return different types for errors (Either, Maybe, Exception, Result etc).

In my case I'm dealing with exceptions (wreq), Maybe values (lens with aeson) and Either values (aeson)!

0

There are 0 answers