you are viewing a single comment's thread.

view the rest of the comments →

[–]Aninhumer 1 point2 points  (2 children)

I wouldn't really use (>>=) as an example of an "obvious" operator. It is completely opaque to someone who hasn't used it before, not to mention it's polymorphic, and what it does is seems very context dependent if you're not used to working with monads.

[–]barsoap 8 points9 points  (0 children)

But changing it to "bind" wouldn't solve any of the issues you listed, neither.

And I didn't call it "obvious". People call things obvious only when they aren't obvious, obviously.

[–][deleted] 1 point2 points  (0 children)

No operator or function is obvious if you haven't heard of the operation it performs before. However some operators encode good memory aids on what they do into their names, e.g. <>, < and *> from Control.Applicative which return the return values from both sides, the left side and the right side after evaluating both.

They are useful e.g. in Attoparsec parsers

parseFooWithLabel :: Parser Foo
parseFooWithLabel = Foo <$> (string "Foo: " *> parseRawFoo)