mirror of
https://github.com/github/semantic.git
synced 2024-12-23 23:11:50 +03:00
Define these
for case analysis over These
.
This commit is contained in:
parent
912823b2cd
commit
d792ddcd57
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user