Fork me on GitHub
#funcool
<
2017-11-22
>
sinistral10:11:06

Thanks for the link @mccraigmccraig. I'll look into that and instaskip; hopefully that will give me a better idea of the patterns (no pun intended) that make sense.

mccraigmccraig10:11:09

i haven't used cats.match myself @sinistral, so can't comment on how straightforward or effective it is - i have surprisingly little code which needs to process error states, so i've been ok with the more awkward branch style approach

sinistral10:11:49

Is that an acceptable approach? Every time I use a branch-*, I can't help but feel that I should be using something like fmap instead. Between branch-* and with-context, I feel like I'm doing something wrong; I feel like I'm adding the kind of boilerplate that monads are monads are supposed to alleviate. (As I said ... very naïve questions, sorry)

mccraigmccraig10:11:15

fmap won't do anything to errored values - that's the point of short-circuit evaulation

mccraigmccraig10:11:07

a quick survey of my codebase - we've got 80kloc and 1000 uses of mlet - but only 20 branches - most of the branches are at component boundaries, doing things like formatting an http error response, so they aren't very common

mccraigmccraig10:11:31

your use-case could be different of course, in which case i'd go for a pattern matching approach

sinistral11:11:15

No, that reinforces my feeling that I'm doing something wrong, and that I'm resorting to branch when I shouldn't be. In most cases, I'd like short-circuit evaluation, but I'm using branch to package function return values correctly ... which probably means that I'm not using return as I should.

sinistral11:11:07

I'll break my use-case down into a simpler example when I have a bit more time; that will give me something concrete to talk about (and hopefully help me to answer my questions on my own).

sinistral11:11:30

Thanks for taking the time to respond @mccraigmccraig.