summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2018-11-01 18:33:10 -0400
committerBen Gamari <ben@smart-cactus.org>2018-11-01 20:32:23 -0400
commitf877d9cc99dd1ba0c038e70527031e9ba0934cd3 (patch)
tree6a225a9cfafc670ca0fb16cd4402efcc059788b6 /compiler/utils
parent1c92f193ee406545daedd06e0b9d5d7354d9af64 (diff)
downloadhaskell-f877d9cc99dd1ba0c038e70527031e9ba0934cd3.tar.gz
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
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Util.hs11
1 files changed, 10 insertions, 1 deletions
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