1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Document Crosswalk.

This commit is contained in:
Rob Rix 2016-03-11 13:19:17 -05:00
parent 283b906cef
commit 7dadd53445

View File

@ -38,6 +38,9 @@ instance Align Maybe where
| otherwise = Nothing | otherwise = Nothing
-- | A functor which can be traversed through an `Align`able functor, inverting the nesting of one in the other.
-- |
-- | 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 class Functor t => Crosswalk t where
crosswalk :: Align f => (a -> f b) -> t a -> f (t b) crosswalk :: Align f => (a -> f b) -> t a -> f (t b)
crosswalk f = sequenceL . fmap f crosswalk f = sequenceL . fmap f