In Haskell, bind and fmap have special characters method names. bind is >>= or >> (depending on the type of bind, but in ruby it would be the same type in both implementation and usage), while fmap can be <$>.
This becomes visually very useful, because you quickly get used to that symbols which are more eye-catching that just another word. You learn to quickly read through them.
In ruby we are more limited about the symbols we can use, however we still have some possibilities:
-
bindcould become just the same of one of the Haskell versions:>>. This is easy to memorize because it is similar to the fish operator>=>, which is monadic function composition, from whichbindis just a specialized version. These right arrows clearly tell something about composing the left to the right. -
fmapin Haskell is<$>because$can be used for function application, which is very similar to whatfmapdoes: applies a function within the container. In Haskell it makes more sense because you write the function to the left and the value to the right:function <$> value. Indry-monadswe are using the other way:value.fmap { ... }, but still we could alias it tocallso we can use just the dot., but we would be very limited in its usage because something likevalue. { ... }is not allowed. So, surely it would be better to find another one.
What do you think?
