File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff 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
110110mergeTheseWith :: (a -> c ) -> (b -> c ) -> (c -> c -> c ) -> These a b -> c
111111mergeTheseWith 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@.
118119here :: (Applicative f ) => (a -> f b ) -> These a t -> f (These b t )
You can’t perform that action at this time.
0 commit comments