diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:16:00 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:16:00 -0400 |
| commit | 08b77f2a0a760a8ab1275e0100b8ebef290ad85a (patch) | |
| tree | 851a59b82609989ac98f18f9d0a950937a8306c2 | |
| parent | b4e7158777e11959fbaf11633ed0aa97168621b3 (diff) | |
minor style improvements
Made some code a little faster..
| -rw-r--r-- | src/Propellor/Property/FreeBSD/Pkg.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Propellor/Property/FreeBSD/Pkg.hs b/src/Propellor/Property/FreeBSD/Pkg.hs index ad9b5f24..1d6e1f68 100644 --- a/src/Propellor/Property/FreeBSD/Pkg.hs +++ b/src/Propellor/Property/FreeBSD/Pkg.hs @@ -71,15 +71,10 @@ upgrade = type Package = String installed :: Package -> Property NoInfo -installed pkg = - check (isInstallable pkg) $ pkgCmdProperty "install" [pkg] +installed pkg = check (isInstallable pkg) $ pkgCmdProperty "install" [pkg] isInstallable :: Package -> IO Bool -isInstallable p = do - l <- isInstalled p - e <- exists p - - return $ (not l) && e +isInstallable p = (not <$> isInstalled p) <&&> exists p isInstalled :: Package -> IO Bool isInstalled p = catch (runPkg "info" [p] >> return True) (\(_ :: IOError ) -> return False) |
