mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Document align/alignWith.
This commit is contained in:
parent
e3eab9df57
commit
283b906cef
@ -9,8 +9,14 @@ import Data.Functor.Identity
|
|||||||
class Functor f => Align f where
|
class Functor f => Align f where
|
||||||
-- | The empty value. The identity value for `align` (modulo the `This` or `That` constructor wrapping the results).
|
-- | The empty value. The identity value for `align` (modulo the `This` or `That` constructor wrapping the results).
|
||||||
nil :: f a
|
nil :: f a
|
||||||
|
-- | Combine two structures into a structure of `These` holding pairs of values in `These` where they overlap, and individual values in `This` and `That` elsewhere.
|
||||||
|
-- |
|
||||||
|
-- | Analogous with `zip`.
|
||||||
align :: f a -> f b -> f (These a b)
|
align :: f a -> f b -> f (These a b)
|
||||||
align = alignWith id
|
align = alignWith id
|
||||||
|
-- | Combine two structures into a structure by applying a function to pairs of values in `These` where they overlap, and individual values in `This` and `That` elsewhere.
|
||||||
|
-- |
|
||||||
|
-- | Analogous with `zipWith`.
|
||||||
alignWith :: (These a b -> c) -> f a -> f b -> f c
|
alignWith :: (These a b -> c) -> f a -> f b -> f c
|
||||||
alignWith f a b = f <$> align a b
|
alignWith f a b = f <$> align a b
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user