Using exceptions for control flow is the root of many evils in software.
4 plus ones
Shared publicly•View activity
View 10 previous comments
- For our internal code we do, but all of our stuff sits on top of libraries from Hackage. For instance our project mismi (on Github) goes through Haskell libraries amazonka, http-conduit, http-client-tls, tls and network before it hits the C code that we'd prefer not to think about. We try to catch all exceptions at the interface between our code and the libraries. That works really well a surprising large amount of the time.4w
- Right, I can definitely see that. In the end, you have an application and you control what goes into it (e.g. by inserting tryEitherT). It's just different if you have a library which allows arbitrary IO at the base of a transformer chain. But, as I said, what you have seems reasonable and practical.4w
- Control.Monad.Trans.Except is :) Ambiata's EitherT combinators look really useful. Have you considered contributing them upstream? Look at how scarce
I get the impression that many "standard libraries" haven't changed a lot since they were written. Now with many companies writing in Haskell, they come up with their own in-house solutions. Maybe I should be careful what I wish for, but sometimes I want a complete rewrite (or rather reorganisation) of base and many popular libraries. And how come GHC doesn't ship with text? No GHC libraries support utf8 except for with String. Is that an issue for Ambiata?4w
- We have tried contributing these upstream (transformers is where they belong) but met resistance. I did manage to get tryEitherT into https://github.com/Gabriel439/Haskell-Errors-Library/commit/f51699de5d6a1ba7456817da5604afeb7f56326f) which I highly recommend.'s errors package (
I agree with you about the standard libraries. Our libraries like p and x insulate us from that so that we can make progress on our work.
And yes we use Text for strings everywhere we can.4w
- I'd prefer if all these nice combinators came with the same package as the definition of EitherT. It's hard to discover what package you should use, even which packages that are available to choose from. That's a problem in the Haskell community. Too much stuff is announced on blog posts and too little written into more permanent texts, guides or whatnot.
Thanks for the pointer to 's package, I'll have a look.4w
- I agree completely. It would be nice to get these combinators more widely used so that we can put pressure on the maintainers of the base libraries to accept these functions.4w