|
|
|
|
|
by DanWaterworth
4179 days ago
|
|
I'm not familiar with swift, but in Haskell, you can't write the following: flatMap :: Either e a -> (a -> Either e b) -> Either e b
flatMap x f =
case x of
Left _ -> x
Right x' -> f x'
In the case expression, you have to write `Left err -> Left err`, because `x` here has the type `Either e a`, but `Either e b` is expected. |
|