module Data.Either.HT ( mapLeft, mapRight, mapBoth, maybeLeft, maybeRight, swap, ) where mapLeft :: (a -> b) -> Either a c -> Either b c mapLeft :: (a -> b) -> Either a c -> Either b c mapLeft a -> b f = (a -> Either b c) -> (c -> Either b c) -> Either a c -> Either b c forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (b -> Either b c forall a b. a -> Either a b Left (b -> Either b c) -> (a -> b) -> a -> Either b c forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> b f) c -> Either b c forall a b. b -> Either a b Right mapRight :: (b -> c) -> Either a b -> Either a c mapRight :: (b -> c) -> Either a b -> Either a c mapRight b -> c f = (a -> Either a c) -> (b -> Either a c) -> Either a b -> Either a c forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either a -> Either a c forall a b. a -> Either a b Left (c -> Either a c forall a b. b -> Either a b Right (c -> Either a c) -> (b -> c) -> b -> Either a c forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> c f) mapBoth :: (a -> c) -> (b -> d) -> Either a b -> Either c d mapBoth :: (a -> c) -> (b -> d) -> Either a b -> Either c d mapBoth a -> c f b -> d g = (a -> Either c d) -> (b -> Either c d) -> Either a b -> Either c d forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (c -> Either c d forall a b. a -> Either a b Left (c -> Either c d) -> (a -> c) -> a -> Either c d forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> c f) (d -> Either c d forall a b. b -> Either a b Right (d -> Either c d) -> (b -> d) -> b -> Either c d forall b c a. (b -> c) -> (a -> b) -> a -> c . b -> d g) maybeLeft :: Either a b -> Maybe a maybeLeft :: Either a b -> Maybe a maybeLeft = (a -> Maybe a) -> (b -> Maybe a) -> Either a b -> Maybe a forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either a -> Maybe a forall a. a -> Maybe a Just (Maybe a -> b -> Maybe a forall a b. a -> b -> a const Maybe a forall a. Maybe a Nothing) maybeRight :: Either a b -> Maybe b maybeRight :: Either a b -> Maybe b maybeRight = (a -> Maybe b) -> (b -> Maybe b) -> Either a b -> Maybe b forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (Maybe b -> a -> Maybe b forall a b. a -> b -> a const Maybe b forall a. Maybe a Nothing) b -> Maybe b forall a. a -> Maybe a Just swap :: Either a b -> Either b a swap :: Either a b -> Either b a swap = (a -> Either b a) -> (b -> Either b a) -> Either a b -> Either b a forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either a -> Either b a forall a b. b -> Either a b Right b -> Either b a forall a b. a -> Either a b Left