fsprojects / Chessie

Railway-oriented programming for .NET
http://fsprojects.github.io/Chessie/
The Unlicense
188 stars 43 forks source link

Add Kleisli composition operator #45

Closed rexcfnghk closed 4 years ago

rexcfnghk commented 8 years ago

>=> is commonly used to compose two functions (e.g. f and g) that each return a monadic value.

It is also in Scott's ROP article

dsyme commented 8 years ago

Please note the F# component design guideline Avoid defining custom symbolic operators in F#-facing library designs

I understand that the library already has symbolic operators defined. But that should be reconsidered, rather than adding new operators.

pblasucci commented 8 years ago

For what it's worth, one technique that I've used with a bit of success is to put the operators in a separate module (usually a nested module) that requires explicit opening (i.e. do NOT use AutoOpenAttribute). This, combined with sufficient documentation, let's more-determined users "opt in" to using the operators. But doesn't clutter the Intellisense or confuse/intimidate folks who are uncomfortable with cryptic symbols. Additionally, the presence of open Foo.Operators in a file helps readers clue-in to the fact that something tricky might be happening. Finally, the other caveat, is that I almost always restrict operator implementations to simply be aliases to named functions.