Great writeup by @djspiewak on pros & cons of catching in map/flatMap. Notably, catch behavior won't be codified as a law in cats-effect, so all you cats out there can play with a lawful Scalaz 8 IO.
https://github.com/typelevel/cats-effect/issues/71#issuecomment-343665818 …
-
Show this thread
-
Another interesting point Daniel makes is that codifying catching as a law breaks all monad transformers outright. It shows this decision (catch/not-catch) is 'sticky'.
1 reply 0 retweets 3 likesShow this thread -
That is, to have lawful catch map/flatMap behavior, you'd have to contaminate all monad transformers with this law, which would likely be incoherent.
1 reply 0 retweets 1 likeShow this thread -
Every implementation that chooses to catch during map/flatMap must do so acknowledging this behavior is unlawful & breaks functor laws, but with the hope that it makes lives easier for developers.
2 replies 1 retweet 2 likesShow this thread -
From what I have seen over the past 2 weeks, many prefer catching during map/flatMap, & many do not. Now devs can choose whatever approach suits them.
1 reply 1 retweet 3 likesShow this thread -
Replying to @jdegoes
If you want to catch, why not explicitly move it to wrapper around either the function being mapped or the call to map, depending on what you're after? Why corrupt a perfectly well-defined function with orthogonal concerns? http://data.map (ignoring_errors(f))
1 reply 0 retweets 1 like
Is the problem the idiotic notion of checked exceptions in Java? Or the unbearable syntactic heaviness of using extensible effects in Haskell or Scala?
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!