1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Document crosswalk and sequenceL.

This commit is contained in:
Rob Rix 2016-03-11 13:21:47 -05:00
parent 7dadd53445
commit a55154c33f

View File

@ -42,9 +42,11 @@ instance Align Maybe where
-- |
-- | Analogous with `zip`, in that it can e.g. turn a tuple of lists into a list of tuples.
class Functor t => Crosswalk t where
-- | Embed a structure into an `Align`able functor by mapping its elements into that functor and convoluting (inverting the embedding).
crosswalk :: Align f => (a -> f b) -> t a -> f (t b)
crosswalk f = sequenceL . fmap f
-- | Convolute (invert the embedding of) a structure over an `Align`able functor.
sequenceL :: Align f => t (f a) -> f (t a)
sequenceL = crosswalk id