Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AllZip implementation match that of All more closely. #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions sop-core/src/Data/SOP/Constraint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,21 @@ class
( SListI xs, SListI ys
, SameShapeAs xs ys, SameShapeAs ys xs
, AllZipF c xs ys
) => AllZip (c :: a -> b -> Constraint) (xs :: [a]) (ys :: [b])
instance
( SListI xs, SListI ys
, SameShapeAs xs ys, SameShapeAs ys xs
, AllZipF c xs ys
) => AllZip c xs ys
) => AllZip (c :: a -> b -> Constraint) (xs :: [a]) (ys :: [b]) where
cpara_SList2 ::
proxy c
-> r '[] '[]
-> (forall x y xs' ys' . (c x y, AllZip c xs' ys') => r xs' ys' -> r (x ': xs') (y ': ys'))
-> r xs ys

instance AllZip c '[] '[] where
cpara_SList2 _p nil _cons = nil
{-# INLINE cpara_SList2 #-}

instance (c x y, AllZip c xs ys) => AllZip c (x : xs) (y : ys) where
cpara_SList2 p nil cons =
cons (cpara_SList2 p nil cons)
{-# INLINE cpara_SList2 #-}

-- | Type family used to implement 'AllZip'.
--
Expand Down Expand Up @@ -229,8 +238,7 @@ instance Coercible (f x) (g y) => LiftedCoercible f g x y
-- elements from two lists of lists.
--
--
class (AllZipF (AllZip f) xss yss, SListI xss, SListI yss, SameShapeAs xss yss, SameShapeAs yss xss) => AllZip2 f xss yss
instance (AllZipF (AllZip f) xss yss, SListI xss, SListI yss, SameShapeAs xss yss, SameShapeAs yss xss) => AllZip2 f xss yss
type AllZip2 f = AllZip (AllZip f)

-- | Composition of constraints.
--
Expand Down