Treat package list instead as a set

This commit is contained in:
Michael Snoyman 2015-03-26 17:57:28 +02:00
parent d69497ebf9
commit 55880e0f15

View File

@ -23,7 +23,9 @@ getBuildPlanR slug = do
fp <- fmap fpToString $ ltsFP $ concat [tshow major, ".", tshow minor]
bp <- liftIO $ decodeFileEither fp >>= either throwIO return
packages <- lookupGetParams "package"
-- treat packages as a set to skip duplicates and make order of parameters
-- irrelevant
packages <- setFromList <$> lookupGetParams "package"
when (null packages) $ invalidArgs ["Must provide at least one package"]
fullDeps <- (== Just "true") <$> lookupGetParam "full-deps"
let eres = runCatch $ execStateT (getDeps bp fullDeps packages) (mempty, id)
@ -79,7 +81,7 @@ type DList a = [a] -> [a]
getDeps :: (MonadThrow m, MonadState TheState m)
=> BuildPlan
-> Bool
-> [Text]
-> Set Text
-> m ()
getDeps BuildPlan {..} fullDeps =
mapM_ (goName . PackageName . unpack)