Commit 12882466 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

base-1.0 does not have Data.Map.alter so use insertWith instead

parent fbbb5f6e
......@@ -209,10 +209,8 @@ mergeBuckets xs@(x:xs') ys@(y:ys') =
insert :: Package pkg => pkg -> PackageIndex pkg -> PackageIndex pkg
insert pkg (PackageIndex index) = mkPackageIndex $
let key = (lowercase . packageName) pkg
in Map.alter insertBucket key index
in Map.insertWith (\_ -> insertNoDup) key [pkg] index
where
insertBucket Nothing = Just [pkg]
insertBucket (Just pkgs) = Just (insertNoDup pkgs)
pkgid = packageId pkg
insertNoDup [] = [pkg]
insertNoDup pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment