@@ -121,7 +121,7 @@ oops = error . ("Data.Align: internal error: " ++)
121
121
-- ≡ mapMaybe justHere (toList (align x y))
122
122
-- @
123
123
--
124
- class Functor f => Semialign f where
124
+ class Unzip f => Semialign f where
125
125
-- | Analogous to @'zip'@, combines two structures by taking the union of
126
126
-- their shapes and using @'These'@ to hold the elements.
127
127
align :: f a -> f b -> f (These a b )
@@ -295,7 +295,7 @@ class Zip f => Repeat f where
295
295
--
296
296
-- For sequence-like types this holds, but for Map-like it doesn't.
297
297
--
298
- class Zip f => Unzip f where
298
+ class Functor f => Unzip f where
299
299
unzipWith :: (c -> (a , b )) -> f c -> (f a , f b )
300
300
unzipWith f = unzip . fmap f
301
301
@@ -337,6 +337,12 @@ class (ZipWithIndex i f, Repeat f) => RepeatWithIndex i f | f -> i where
337
337
-- base
338
338
-------------------------------------------------------------------------------
339
339
340
+ -- |
341
+ --
342
+ -- @since 1.4
343
+ instance Unzip ((-> ) e ) where
344
+ unzip = unzipDefault
345
+
340
346
instance Semialign ((-> ) e ) where
341
347
align f g x = These (f x) (g x)
342
348
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
661
667
-------------------------------------------------------------------------------
662
668
663
669
-- 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
+
664
677
instance Monad m => Align (Stream m ) where
665
678
nil = Stream. empty
666
679
@@ -688,9 +701,16 @@ instance Monad m => Semialign (Stream m) where
688
701
_ -> Skip (sa, sb, Nothing , False )
689
702
#endif
690
703
704
+
691
705
instance Monad m => Zip (Stream m ) where
692
706
zipWith = Stream. zipWith
693
707
708
+ -- |
709
+ --
710
+ -- @since 1.4
711
+ instance Monad m => Unzip (Bundle m v ) where
712
+ unzip = unzipDefault
713
+
694
714
instance Monad m => Align (Bundle m v ) where
695
715
nil = Bundle. empty
696
716
0 commit comments