another place to use toResult

This commit is contained in:
Joey Hess 2014-12-08 01:12:55 -04:00
parent 6b6d5a0881
commit 06975ec5e1
1 changed files with 4 additions and 6 deletions

View File

@ -148,18 +148,16 @@ sourceInstall = property "debootstrap installed from source" (liftIO sourceInsta
`requires` arInstalled `requires` arInstalled
perlInstalled :: Property perlInstalled :: Property
perlInstalled = check (not <$> inPath "perl") $ property "perl installed" $ do perlInstalled = check (not <$> inPath "perl") $ property "perl installed" $
v <- liftIO $ firstM id liftIO $ toResult . isJust <$> firstM id
[ yumInstall "perl" [ yumInstall "perl"
] ]
if isJust v then return MadeChange else return FailedChange
arInstalled :: Property arInstalled :: Property
arInstalled = check (not <$> inPath "ar") $ property "ar installed" $ do arInstalled = check (not <$> inPath "ar") $ property "ar installed" $
v <- liftIO $ firstM id liftIO $ toResult . isJust <$> firstM id
[ yumInstall "binutils" [ yumInstall "binutils"
] ]
if isJust v then return MadeChange else return FailedChange
yumInstall :: String -> IO Bool yumInstall :: String -> IO Bool
yumInstall p = boolSystem "yum" [Param "-y", Param "install", Param p] yumInstall p = boolSystem "yum" [Param "-y", Param "install", Param p]