@@ -121,7 +121,7 @@ oops = error . ("Data.Align: internal error: " ++)
121121-- ≡ mapMaybe justHere (toList (align x y))
122122-- @
123123--
124- class Functor f => Semialign f where
124+ class Unzip f => Semialign f where
125125 -- | Analogous to @'zip'@, combines two structures by taking the union of
126126 -- their shapes and using @'These'@ to hold the elements.
127127 align :: f a -> f b -> f (These a b )
@@ -295,7 +295,7 @@ class Zip f => Repeat f where
295295--
296296-- For sequence-like types this holds, but for Map-like it doesn't.
297297--
298- class Zip f => Unzip f where
298+ class Functor f => Unzip f where
299299 unzipWith :: (c -> (a , b )) -> f c -> (f a , f b )
300300 unzipWith f = unzip . fmap f
301301
@@ -337,6 +337,12 @@ class (ZipWithIndex i f, Repeat f) => RepeatWithIndex i f | f -> i where
337337-- base
338338-------------------------------------------------------------------------------
339339
340+ -- |
341+ --
342+ -- @since 1.4
343+ instance Unzip ((-> ) e ) where
344+ unzip = unzipDefault
345+
340346instance Semialign ((-> ) e ) where
341347 align f g x = These (f x) (g x)
342348 alignWith h f g x = h (These (f x) (g x))
@@ -661,6 +667,13 @@ instance (RepeatWithIndex i f, RepeatWithIndex j g) => RepeatWithIndex (i, j) (C
661667-------------------------------------------------------------------------------
662668
663669-- Based on the Data.Vector.Fusion.Stream.Monadic zipWith implementation
670+
671+ -- |
672+ --
673+ -- @since 1.4
674+ instance Monad m => Unzip (Stream m ) where
675+ unzip = unzipDefault
676+
664677instance Monad m => Align (Stream m ) where
665678 nil = Stream. empty
666679
@@ -688,9 +701,16 @@ instance Monad m => Semialign (Stream m) where
688701 _ -> Skip (sa, sb, Nothing , False )
689702#endif
690703
704+
691705instance Monad m => Zip (Stream m ) where
692706 zipWith = Stream. zipWith
693707
708+ -- |
709+ --
710+ -- @since 1.4
711+ instance Monad m => Unzip (Bundle m v ) where
712+ unzip = unzipDefault
713+
694714instance Monad m => Align (Bundle m v ) where
695715 nil = Bundle. empty
696716
0 commit comments