mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Revert "Add a maybeThese function to simplify constructing These from Maybes."
This reverts commit 0893da5b7fb31bde527d3580e6daa04db5f7df3c.
This commit is contained in:
parent
fcaa498033
commit
4fa1067611
@ -17,13 +17,6 @@ these _ _ f (These this that) = f this that
|
||||
fromThese :: a -> b -> These a b -> (a, b)
|
||||
fromThese a b = these (flip (,) b) ((,) a) (,)
|
||||
|
||||
-- | Given a pair of Maybes, produce a These containing Just their values, or Nothing if they haven’t any.
|
||||
maybeThese :: Maybe a -> Maybe b -> Maybe (These a b)
|
||||
maybeThese (Just a) (Just b) = Just (These a b)
|
||||
maybeThese (Just a) _ = Just (This a)
|
||||
maybeThese _ (Just b) = Just (That b)
|
||||
maybeThese _ _ = Nothing
|
||||
|
||||
-- | Return Just the value in This, or the first value in These, if any.
|
||||
maybeFst :: These a b -> Maybe a
|
||||
maybeFst = these Just (const Nothing) ((Just .) . const)
|
||||
|
Loading…
Reference in New Issue
Block a user