From 8260c08cdd5c7e0b561aa9d36cb84115e37bcad5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 14 Mar 2016 20:18:53 -0400 Subject: [PATCH] Add a swap function to flip These. --- src/Data/Bifunctor/These.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Data/Bifunctor/These.hs b/src/Data/Bifunctor/These.hs index 935ee7012..da6aaa8e4 100644 --- a/src/Data/Bifunctor/These.hs +++ b/src/Data/Bifunctor/These.hs @@ -19,6 +19,8 @@ maybeFirst = these Just (const Nothing) ((Just .) . const) maybeSecond :: These a b -> Maybe b maybeSecond = these (const Nothing) Just ((Just .) . flip const) +swap :: These a b -> These b a +swap = these That This (flip These) -- Instances