From f877d9cc99dd1ba0c038e70527031e9ba0934cd3 Mon Sep 17 00:00:00 2001 From: mniip Date: Thu, 1 Nov 2018 18:33:10 -0400 Subject: Move eta-reduced coaxiom compatibility handling quirks into FamInstEnv. The quirk caused an issue where GHC concluded that 'D' is possibly unifiable with 'D a' (the two types could have the same kind if D is a data family). Test Plan: Ensure T9371 stays fixed. Introduce T15704 Reviewers: goldfire, bgamari Reviewed By: goldfire Subscribers: RyanGlScott, rwbarton, carter GHC Trac Issues: #15704 Differential Revision: https://phabricator.haskell.org/D5206 --- compiler/utils/Util.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'compiler/utils') diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index c348f79888..c6c5362112 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -16,7 +16,7 @@ module Util ( -- * General list processing zipEqual, zipWithEqual, zipWith3Equal, zipWith4Equal, - zipLazy, stretchZipWith, zipWithAndUnzip, + zipLazy, stretchZipWith, zipWithAndUnzip, zipAndUnzip, zipWithLazy, zipWith3Lazy, @@ -441,6 +441,15 @@ zipWithAndUnzip f (a:as) (b:bs) (r1:rs1, r2:rs2) zipWithAndUnzip _ _ _ = ([],[]) +-- | This has the effect of making the two lists have equal length by dropping +-- the tail of the longer one. +zipAndUnzip :: [a] -> [b] -> ([a],[b]) +zipAndUnzip (a:as) (b:bs) + = let (rs1, rs2) = zipAndUnzip as bs + in + (a:rs1, b:rs2) +zipAndUnzip _ _ = ([],[]) + mapAccumL2 :: (s1 -> s2 -> a -> (s1, s2, b)) -> s1 -> s2 -> [a] -> (s1, s2, [b]) mapAccumL2 f s1 s2 xs = (s1', s2', ys) where ((s1', s2'), ys) = mapAccumL (\(s1, s2) x -> case f s1 s2 x of -- cgit v1.2.1