1- {-# LANGUAGE PolyKinds, StandaloneDeriving, UndecidableInstances #-}
1+ {-# LANGUAGE PolyKinds #-}
2+ {-# LANGUAGE StandaloneDeriving #-}
3+ {-# LANGUAGE UndecidableInstances #-}
24-- | n-ary products (and products of products)
35module Data.SOP.NP
46 ( -- * Datatypes
@@ -713,15 +715,14 @@ ctraverse_POP = hctraverse
713715--
714716cata_NP ::
715717 forall r f xs .
716- r '[]
717- -> (forall y ys . f y -> r ys -> r (y ': ys ))
718+ SListI xs
719+ => r '[]
720+ -> (forall y ys . SListI ys => f y -> r ys -> r (y ': ys ))
718721 -> NP f xs
719722 -> r xs
720- cata_NP nil cons = go
721- where
722- go :: forall ys . NP f ys -> r ys
723- go Nil = nil
724- go (x :* xs) = cons x (go xs)
723+ cata_NP nil cons =
724+ ccata_NP topP nil cons
725+ {-# INLINE cata_NP #-}
725726
726727-- | Constrained catamorphism for 'NP'.
727728--
@@ -733,10 +734,11 @@ cata_NP nil cons = go
733734-- @since 0.2.3.0
734735--
735736ccata_NP ::
736- forall c proxy r f xs . (All c xs )
737+ forall c proxy r f xs .
738+ All c xs
737739 => proxy c
738740 -> r '[]
739- -> (forall y ys . c y => f y -> r ys -> r (y ': ys ))
741+ -> (forall y ys . ( c y , All c ys ) => f y -> r ys -> r (y ': ys ))
740742 -> NP f xs
741743 -> r xs
742744ccata_NP _ nil cons = go
@@ -759,7 +761,7 @@ ccata_NP _ nil cons = go
759761ana_NP ::
760762 forall s f xs .
761763 SListI xs
762- => (forall y ys . s (y ': ys ) -> (f y , s ys ))
764+ => (forall y ys . SListI ys => s (y ': ys ) -> (f y , s ys ))
763765 -> s xs
764766 -> NP f xs
765767ana_NP uncons =
@@ -775,14 +777,15 @@ ana_NP uncons =
775777-- @since 0.2.3.0
776778--
777779cana_NP ::
778- forall c proxy s f xs . (All c xs )
780+ forall c proxy s f xs .
781+ All c xs
779782 => proxy c
780- -> (forall y ys . c y => s (y ': ys ) -> (f y , s ys ))
783+ -> (forall y ys . ( c y , All c ys ) => s (y ': ys ) -> (f y , s ys ))
781784 -> s xs
782785 -> NP f xs
783786cana_NP _ uncons = go sList
784787 where
785- go :: forall ys . ( All c ys ) => SList ys -> s ys -> NP f ys
788+ go :: forall ys . All c ys => SList ys -> s ys -> NP f ys
786789 go SNil _ = Nil
787790 go SCons s = case uncons s of
788791 (x, s') -> x :* go sList s'
0 commit comments