remove-old-stack-work-libs.hs: need to check regexp match result

This commit is contained in:
Jens Petersen 2020-05-19 14:08:36 +08:00
parent 86e5490e70
commit f905c9455d

View File

@ -28,8 +28,9 @@ main = do
extractNameInternal :: String -> String
extractNameInternal p =
let (name,_,internal) = p =~ "-[0-9.]+-[0-9A-Za-z]{20,22}" :: (String, String, String)
in name ++ internal
let (name,match,internal) = p =~ "-[0-9.]+-[0-9A-Za-z]{20,22}" :: (String, String, String)
in if null match || null name then error $ p ++ " not in correct name-version-hash format"
else name ++ internal
samePkgDynLib d1 d2 = pkgDynName d1 == pkgDynName d2
where