4 ms·
This to me is the biggest barrier to reading anyone else's Haskell code. It seems like it's always full of unfamiliar, ungooglable infix operators.
by thrwwy5 11y ago
This to me is the biggest barrier to reading anyone else's Haskell code. It seems like it's always full of unfamiliar, ungooglable infix operators.
- dullcrisp 11y agoTry https://www.haskell.org/hoogle/ https://www.haskell.org/hoogle/.
- thrwwy5 11y agothanks
- wetmore 11y agoIf you are hired at a company exclusively doing Haskell there is no way you haven't seen <$>, <*>, or (,) before. In this case, the reason the OP didn't think of writing it with Applicative isn't because he didn't know about them (I assume), but just because he didn't think to use it in that particular case.
- jbergens 11y agoThat is one point of having code reviews, to get everyone in a team or an organization to write (mostly) the same type of code.
- thom 11y agoOne of our Haskellers once tried to explain the bizarre internal consistency of the many Haskell's lens operators. It's basically just trolling in API form: https://hackage.haskell.org/package/lens-3.8.5/docs/Control-Lens-Operators.html https://hackage.haskell.org/package/lens-3.8.5/docs/Control-...
- tel 11y agoIt's tragic people feel that way. They're actually very well-designed, but if you don't like operator soup then no amount of design will convince you otherwise. Which is fine and why the Lens package is able to be imported operator-free.
- spopejoy 11y agoMy problem with the operators is they screw up function composition. `over`, `set`, `view`, `firstOf`, `toListOf` compose normally with the datastructure on the right. The operators flip this and therefore require the dumb `&`. It's kind of like diagrams with `#`. I don't accept the argument that if it's a lens or a diagram, our meager brains can't comprehend right-to-left composition anymore. Worst of all is when there isn't a non-infix alternative, effectively forcing you to use the soup. Case in point: `%=`.
- tel 11y agoThe non-infix names are a bit more conservative, yes, but it's easy to define your own of course. And to even argue back about $ and & is pretty bike-sheddy. It's just a choice that was made.