Skip to content

Commit 5a92673

Browse files
author
Isaac Shapira
committed
change name and haddock
1 parent c2c778c commit 5a92673

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Data/These.hs

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Data.These (
1414
, fromThese
1515
, mergeThese
1616
, mergeTheseWith
17-
, fromAlt
17+
, optionally
1818

1919
-- * Traversals
2020
, here, there
@@ -110,9 +110,10 @@ mergeThese = these id id
110110
mergeTheseWith :: (a -> c) -> (b -> c) -> (c -> c -> c) -> These a b -> c
111111
mergeTheseWith f g op t = mergeThese op $ mapThese f g t
112112

113-
-- | Construct These inside an Alternative.
114-
fromAlt :: Alternative f => f a -> f b -> f (These a b)
115-
fromAlt x y = These <$> x <*> y <|> That <$> y <|> This <$> x
113+
-- | Construct These inside an Alternative.
114+
-- Consider @Control.Applicative.optional` for intuition.
115+
optionally :: Alternative f => f a -> f b -> f (These a b)
116+
optionally x y = These <$> x <*> y <|> This <$> x <|> That <$> y
116117

117118
-- | A @Traversal@ of the first half of a 'These', suitable for use with @Control.Lens@.
118119
here :: (Applicative f) => (a -> f b) -> These a t -> f (These b t)

0 commit comments

Comments
 (0)