Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
I created an example repository. I'm aware of tricks such as this one. But I find it really hard to avoid the increasing right indentation without making the code hard to understand because of runExceptT and the likes everywhere. To give you a bit more info before clicking the repository link: in the actual app, m would be the application monad (think ReaderT pattern), and so you might often see m (Maybe String) or m (Either String) being returned. It's then hard to compose two functions like that. I'm aware that you can do MonadPlus m and MonadError String m but I can't get this to work while still preserving the error messages depending on where I got a Nothing value.
Idris2 has a great syntax for this, see e.g. node018: