[Haskell-beginners] What is this?
Dimitri DeFigueiredo
defigueiredo at ucdavis.edu
Wed Nov 13 19:04:22 UTC 2019
Hello,
Can anyone shed a light on the proper way to write the function below.
It looks pretty standard, but it's not clear to me what it is?
data Abortable res = Aborted | Executed res deriving Functor -- i.e. Maybe
abortableThroughEither :: Abortable (Either a b) -> Either a (Abortable b)
abortableThroughEither Aborted = Right Aborted
abortableThroughEither (Executed (Left a)) = Left a
abortableThroughEither (Executed (Right b)) = Right (Executed b)
Thanks!
Dimitri
--
2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F
More information about the Beginners
mailing list