Renamed our permutations function to permutation to avoid a conflict with a new GHC 6.10 function
This commit is contained in:
parent
09e0e46ec2
commit
ee62c604fc
|
@ -402,7 +402,7 @@ testOccamPassTransform str trans code pass
|
|||
(exp, expS) = runState expm emptyState
|
||||
(inp, inpS) = runState inpm emptyState
|
||||
in TestCase $ testPassWithStateCheck str (trans $ mkPattern exp) pass inp (put inpS) (testPatternMatchOneOf
|
||||
(str ++ " state check") [trans $ mkPattern pr | pr <- permutations $ Map.toList $ csNames expS] . Map.toList
|
||||
(str ++ " state check") [trans $ mkPattern pr | pr <- permutation $ Map.toList $ csNames expS] . Map.toList
|
||||
. csNames)
|
||||
-- It's important to convert the maps to lists first, as Map doesn't have a
|
||||
-- Data instance.
|
||||
|
|
|
@ -241,9 +241,13 @@ productN (xs:xss) = [ y : ys | y <- xs, ys <- yss]
|
|||
--
|
||||
-- Code is taken from: http://www.haskell.org/pipermail/haskell/2006-July/018298.html
|
||||
-- and then fixed (missing base case, x should have been y)
|
||||
permutations :: [a] -> [[a]]
|
||||
permutations [] = [[]]
|
||||
permutations xs = [y : ps | (y,ys) <- selections xs, ps <- permutations ys]
|
||||
--
|
||||
-- Since GHC 6.10 onwards includes a permutations function, but we don't want to
|
||||
-- have to mess with the GHC preprocessor just to exclude this one function, I've
|
||||
-- renamed ours to permutation.
|
||||
permutation :: [a] -> [[a]]
|
||||
permutation [] = [[]]
|
||||
permutation xs = [y : ps | (y,ys) <- selections xs, ps <- permutation ys]
|
||||
where
|
||||
selections [] = []
|
||||
selections (x:xs) = (x,xs) : [(y,x:ys) | (y,ys) <- selections xs]
|
||||
|
|
Loading…
Reference in New Issue
Block a user