4 ms·
The corresponding type signature in haskell is bind :: (a -> Either b c) -> Either a c -> Either b c So really you just save yourself a couple of angle b
by gamegoblin 12y ago
The corresponding type signature in haskell is
bind :: (a -> Either b c) -> Either a c -> Either b c
So really you just save yourself a couple of angle brackets.
That being said, the author does introduce the (>>=) function, but just doesn't say monad because that can turn people off really quickly.
- nightski 12y agoI'd say it's the quotes that are noisy, not the angle brackets. But it's a minor nitpick, the F# one is fine.
- thinkpad20 12y agoI was slightly mistaken, because I missed how the error type was put last in all of those Results. In Haskell, the error type is typically written first (Either MyError x), because since `Either a` is an instance of monad, we can replace `Either a` with `m` and get bind :: (a -> m b) -> m a -> m b Which is exactly the signature of (=<<). So you don't just get a cleaner syntax; you now have the ability to use `bind` with any monad (Maybe, List, IO, State...).