Avoid invalid pattern match #108

This commit is contained in:
Michael Snoyman 2015-06-18 07:16:25 +03:00
parent 7f62b5b8f6
commit b1942934bb

View File

@ -594,12 +594,14 @@ latestHelper pname clause = fmap (fmap toLatest) $ E.select $ E.from $ \(s,ln,p,
getDeps :: GetStackageDatabase m => Text -> m [(Text, Text)] getDeps :: GetStackageDatabase m => Text -> m [(Text, Text)]
getDeps pname = run $ do getDeps pname = run $ do
Just (Entity pid _) <- getBy $ UniquePackage pname mp <- getBy $ UniquePackage pname
fmap (map toPair) $ E.select $ E.from $ \d -> do case mp of
E.where_ $ Nothing -> return []
(d E.^. DepUser E.==. E.val pid) Just (Entity pid _) -> fmap (map toPair) $ E.select $ E.from $ \d -> do
E.orderBy [E.asc $ d E.^. DepUses] E.where_ $
return (d E.^. DepUses, d E.^. DepRange) (d E.^. DepUser E.==. E.val pid)
E.orderBy [E.asc $ d E.^. DepUses]
return (d E.^. DepUses, d E.^. DepRange)
where where
toPair (E.Value x, E.Value y) = (x, y) toPair (E.Value x, E.Value y) = (x, y)