top | item 42755697

(no title)

mbwgh | 1 year ago

> >> is an old name for >

I once had a hard to track down bug in some code making use of conduit[0], which is introduced using examples like `main = runConduit $ (yield 1 >> yield 2) .| mapM_C print`.

Dutifully replacing every occurrence of (>>) with (>), because it was more modern, suddenly changed the semantics somewhere, due to the fact that (>>) is defined with fixity `infixl 1 >>` and (>) as `infixl 4 >` - i.e. both are left-associated operators, but (*>) binds tighter than (>>) and some of the myriad of other operators you may encounter.

-- [0] - https://github.com/snoyberg/conduit

discuss

order

_0ffh|1 year ago

Maybe I'm not so bad for using "superfluous" braces quite often, although this is not specifically the reason why I do.

tome|1 year ago

This is a bit surprising. Why replace `>>` with `*>` "because it's more modern"? Can't you just stick with what's working? The former hasn't been deprecated.

mbwgh|1 year ago

You are absolutely correct and I was an idiot without a proper understanding of premature abstraction or unnecessary complexity.

If I were to start a new side-project using Haskell today (I probably won't), I would just stick to do-notation and even concrete types (instead of mtl-style or what have you) where possible.