vicfg: Deleting configurations now resets to the default, where before it has no effect.

Added a Default instance for TrustLevel, and was able to use that to clear
up several other parts of the code too.

This commit was sponsored by Stephan Schulz
This commit is contained in:
Joey Hess 2014-10-14 14:10:22 -04:00
parent 5fcb75d371
commit db9121ecee
7 changed files with 41 additions and 5 deletions

View file

@ -19,6 +19,7 @@ module Logs.Trust (
) where
import qualified Data.Map as M
import Data.Default
import Common.Annex
import Types.TrustLevel
@ -38,7 +39,7 @@ trustGet level = M.keys . M.filter (== level) <$> trustMap
{- Returns the TrustLevel of a given repo UUID. -}
lookupTrust :: UUID -> Annex TrustLevel
lookupTrust u = (fromMaybe SemiTrusted . M.lookup u) <$> trustMap
lookupTrust u = (fromMaybe def . M.lookup u) <$> trustMap
{- Partitions a list of UUIDs to those matching a TrustLevel and not. -}
trustPartition :: TrustLevel -> [UUID] -> Annex ([UUID], [UUID])