diff --git a/src/Data/Bifunctor/These.hs b/src/Data/Bifunctor/These.hs index aa55460c8..c82eceda4 100644 --- a/src/Data/Bifunctor/These.hs +++ b/src/Data/Bifunctor/These.hs @@ -5,6 +5,12 @@ import Data.Bifunctor data These a b = This a | That b | These a b deriving (Eq, Show) +-- | Eliminate These by case analysis. +these :: (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c +these f _ _ (This this) = f this +these _ f _ (That that) = f that +these _ _ f (These this that) = f this that + -- Instances