summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Locale.hs
diff options
context:
space:
mode:
authorJoey Hess2015-12-05 19:29:15 -0400
committerJoey Hess2015-12-05 19:29:15 -0400
commitd2406996c7d71f310be3d390d531812e3d0d4521 (patch)
tree3181ba45b78b1a76f23bc281de4c9c4ca4ce50a2 /src/Propellor/Property/Locale.hs
parent277adba731d66e642bc8f5bdfd37c3590ec40ec4 (diff)
refactor
Diffstat (limited to 'src/Propellor/Property/Locale.hs')
-rw-r--r--src/Propellor/Property/Locale.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Propellor/Property/Locale.hs b/src/Propellor/Property/Locale.hs
index 15babf20..29de8df2 100644
--- a/src/Propellor/Property/Locale.hs
+++ b/src/Propellor/Property/Locale.hs
@@ -34,9 +34,13 @@ locale `selectedFor` vars = select <!> deselect
deselect' = cmdProperty "update-locale" vars
`assume` MadeChange
selectArgs = zipWith (++) vars (repeat ('=':locale))
- isselected = do
- ls <- catchDefaultIO [] $ lines <$> readFile "/etc/default/locale"
- return $ and $ map (\v -> v ++ "=" ++ locale `elem` ls) vars
+ isselected = locale `isSelectedFor` vars
+
+isSelectedFor :: Locale -> [LocaleVariable] -> IO Bool
+locale `isSelectedFor` vars = do
+ ls <- catchDefaultIO [] $ lines <$> readFile "/etc/default/locale"
+ return $ and $ map (\v -> v ++ "=" ++ locale `elem` ls) vars
+
-- | Ensures a locale is generated (or, if reverted, ensure it's not).
--