Closed rexcfnghk closed 4 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.
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.
>=>
is commonly used to compose two functions (e.g.f
andg
) that each return a monadic value.It is also in Scott's ROP article