3 ms·
I have found the same to be true whenever I've tried to do anything in Haskell, especially with regards to error handling. I would try to decide on a specific s
by joseph 10y ago
I have found the same to be true whenever I've tried to do anything in Haskell, especially with regards to error handling. I would try to decide on a specific style of handling errors, but the libraries I depended on maybe did it differently. So there ended up being a lot of boilerplate code to wrap other libraries to my own particular style.
A lot of the problems I encountered probably boiled down to inexperience on my part, and perhaps not understanding idiomatic ways of doing things in the language. But another part of it is that I think the community has not settled on a set of common idioms.
There are things about Haskell that I absolutely love. The expressiveness is amazing. Chaining a monadic sequence can feel magical at times. Treating errors as just values is nice. But what do you do when the libraries that you depend on throw exceptions instead of using Either?
And those awful compiler errors can be so, so frustrating. But I will return to you again one day, dear Haskell.
- mercurial 10y ago> Chaining a monadic sequence can feel magical at times. The issue is when this monad is actually a monad transformer tower, in which case there is actually a bunch of "magic" happening at each line.
- tome 10y ago> what do you do when the libraries that you depend on throw exceptions instead of using Either? File a bug on them
- krotton 10y agoAnd wait forever instead of getting any actual work done.
- dllthomas 10y ago> But what do you do when the libraries that you depend on throw exceptions instead of using Either? tome's response is amusing, but assuming you need to keep getting work done and aren't interested in forking the library... You wrap the library in a shim that forces the return values, catches anything that's thrown, and returns Either. If it's a library that you only use in one or two places, that shim might be inlined.
- dllthomas 10y agoI should note that, where you prefer to be dealing with exceptions, it's trivial to go the other way with a shim as well.