summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-28 16:11:28 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-28 16:11:28 -0400
commit82161654830b0dc4187e9928555c9321ef61bb89 (patch)
treefef3edba1366663956ed484a9c9951616765d505
parent7ca8ec00a7fcda71a08d22f06838424765a1b215 (diff)
import Data.Default in Common
-rw-r--r--Annex/Content.hs4
-rw-r--r--Annex/FileMatcher.hs6
-rw-r--r--Annex/Wanted.hs8
-rw-r--r--Common.hs1
-rw-r--r--Config.hs4
-rw-r--r--Logs.hs2
-rw-r--r--Logs/PreferredContent.hs6
-rw-r--r--Remote/External.hs1
-rw-r--r--Remote/Hook.hs1
-rw-r--r--Remote/Rsync.hs1
-rw-r--r--Types/GitConfig.hs4
-rw-r--r--Utility/Url.hs1
12 files changed, 17 insertions, 22 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index a78cf674c..f91c1e72a 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -110,10 +110,10 @@ inAnnexSafe key = inAnnex' (fromMaybe False) (Just False) go key
( checkOr is_unlocked lockfile
, return is_missing
)
- checkOr def lockfile = do
+ checkOr d lockfile = do
v <- checkLocked lockfile
return $ case v of
- Nothing -> def
+ Nothing -> d
Just True -> is_locked
Just False -> is_unlocked
#else
diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs
index c6a729a9c..16ade922c 100644
--- a/Annex/FileMatcher.hs
+++ b/Annex/FileMatcher.hs
@@ -28,12 +28,12 @@ checkFileMatcher :: (FileMatcher Annex) -> FilePath -> Annex Bool
checkFileMatcher matcher file = checkMatcher matcher Nothing (Just file) S.empty True
checkMatcher :: (FileMatcher Annex) -> Maybe Key -> AssociatedFile -> AssumeNotPresent -> Bool -> Annex Bool
-checkMatcher matcher mkey afile notpresent def
- | isEmpty matcher = return def
+checkMatcher matcher mkey afile notpresent d
+ | isEmpty matcher = return d
| otherwise = case (mkey, afile) of
(_, Just file) -> go =<< fileMatchInfo file
(Just key, _) -> go (MatchingKey key)
- _ -> return def
+ _ -> return d
where
go mi = matchMrun matcher $ \a -> a notpresent mi
diff --git a/Annex/Wanted.hs b/Annex/Wanted.hs
index 87b4377c2..ba7df0a9c 100644
--- a/Annex/Wanted.hs
+++ b/Annex/Wanted.hs
@@ -15,15 +15,15 @@ import qualified Data.Set as S
{- Check if a file is preferred content for the local repository. -}
wantGet :: Bool -> Maybe Key -> AssociatedFile -> Annex Bool
-wantGet def key file = isPreferredContent Nothing S.empty key file def
+wantGet d key file = isPreferredContent Nothing S.empty key file d
{- Check if a file is preferred content for a remote. -}
wantSend :: Bool -> Maybe Key -> AssociatedFile -> UUID -> Annex Bool
-wantSend def key file to = isPreferredContent (Just to) S.empty key file def
+wantSend d key file to = isPreferredContent (Just to) S.empty key file d
{- Check if a file can be dropped, maybe from a remote.
- Don't drop files that are preferred content. -}
wantDrop :: Bool -> Maybe UUID -> Maybe Key -> AssociatedFile -> Annex Bool
-wantDrop def from key file = do
+wantDrop d from key file = do
u <- maybe getUUID (return . id) from
- not <$> isPreferredContent (Just u) (S.singleton u) key file def
+ not <$> isPreferredContent (Just u) (S.singleton u) key file d
diff --git a/Common.hs b/Common.hs
index 9333a19d9..8272043c2 100644
--- a/Common.hs
+++ b/Common.hs
@@ -11,6 +11,7 @@ import Data.Maybe as X
import Data.List as X hiding (head, tail, init, last)
import Data.String.Utils as X hiding (join)
import Data.Monoid as X
+import Data.Default as X
import System.FilePath as X
import System.Directory as X
diff --git a/Config.hs b/Config.hs
index 57ced7821..29135ed96 100644
--- a/Config.hs
+++ b/Config.hs
@@ -23,7 +23,7 @@ instance Show ConfigKey where
{- Looks up a setting in git config. -}
getConfig :: ConfigKey -> String -> Annex String
-getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def
+getConfig (ConfigKey key) d = fromRepo $ Git.Config.get key d
getConfigMaybe :: ConfigKey -> Annex (Maybe String)
getConfigMaybe (ConfigKey key) = fromRepo $ Git.Config.getMaybe key
@@ -58,7 +58,7 @@ annexConfig key = ConfigKey $ "annex." ++ key
- by remote.<name>.annex-cost, or if remote.<name>.annex-cost-command
- is set and prints a number, that is used. -}
remoteCost :: RemoteGitConfig -> Cost -> Annex Cost
-remoteCost c def = fromMaybe def <$> remoteCost' c
+remoteCost c d = fromMaybe d <$> remoteCost' c
remoteCost' :: RemoteGitConfig -> Annex (Maybe Cost)
remoteCost' c = case remoteAnnexCostCommand c of
diff --git a/Logs.hs b/Logs.hs
index 7e4a39533..b0f330e93 100644
--- a/Logs.hs
+++ b/Logs.hs
@@ -10,8 +10,6 @@ module Logs where
import Common.Annex
import Types.Key
-import Data.Default
-
{- There are several varieties of log file formats. -}
data LogVariety
= UUIDBasedLog
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs
index 83269e6d7..6c885041a 100644
--- a/Logs/PreferredContent.hs
+++ b/Logs/PreferredContent.hs
@@ -52,12 +52,12 @@ isRequiredContent :: Maybe UUID -> AssumeNotPresent -> Maybe Key -> AssociatedFi
isRequiredContent = checkMap requiredContentMap
checkMap :: Annex (FileMatcherMap Annex) -> Maybe UUID -> AssumeNotPresent -> Maybe Key -> AssociatedFile -> Bool -> Annex Bool
-checkMap getmap mu notpresent mkey afile def = do
+checkMap getmap mu notpresent mkey afile d = do
u <- maybe getUUID return mu
m <- getmap
case M.lookup u m of
- Nothing -> return def
- Just matcher -> checkMatcher matcher mkey afile notpresent def
+ Nothing -> return d
+ Just matcher -> checkMatcher matcher mkey afile notpresent d
preferredContentMap :: Annex (FileMatcherMap Annex)
preferredContentMap = maybe (fst <$> preferredRequiredMapsLoad) return
diff --git a/Remote/External.hs b/Remote/External.hs
index b660c4f1b..0579400ed 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -28,7 +28,6 @@ import Creds
import Control.Concurrent.STM
import System.Log.Logger (debugM)
import qualified Data.Map as M
-import Data.Default
remote :: RemoteType
remote = RemoteType {
diff --git a/Remote/Hook.hs b/Remote/Hook.hs
index 31b5ab7c5..592564772 100644
--- a/Remote/Hook.hs
+++ b/Remote/Hook.hs
@@ -18,7 +18,6 @@ import Annex.UUID
import Remote.Helper.Special
import Utility.Env
-import Data.Default
import qualified Data.Map as M
type Action = String
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 527bfb80a..04bbb19a7 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -38,7 +38,6 @@ import Logs.Transfer
import Types.Creds
import Types.Key (isChunkKey)
-import Data.Default
import qualified Data.Map as M
remote :: RemoteType
diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs
index 5ac524f45..ef8f2f2bd 100644
--- a/Types/GitConfig.hs
+++ b/Types/GitConfig.hs
@@ -98,7 +98,7 @@ extractGitConfig r = GitConfig
, annexDifferences = getDifferences r
}
where
- getbool k def = fromMaybe def $ getmaybebool k
+ getbool k d = fromMaybe d $ getmaybebool k
getmaybebool k = Git.Config.isTrue =<< getmaybe k
getmayberead k = readish =<< getmaybe k
getmaybe k = Git.Config.getMaybe k r
@@ -178,7 +178,7 @@ extractRemoteGitConfig r remotename = RemoteGitConfig
, remoteGitConfig = Nothing
}
where
- getbool k def = fromMaybe def $ getmaybebool k
+ getbool k d = fromMaybe d $ getmaybebool k
getmaybebool k = Git.Config.isTrue =<< getmaybe k
getmayberead k = readish =<< getmaybe k
getmaybe k = mplus (Git.Config.getMaybe (key k) r)
diff --git a/Utility/Url.hs b/Utility/Url.hs
index cb4fc7d37..ddf5eea40 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -28,7 +28,6 @@ import Common
import Network.URI
import Network.HTTP.Conduit
import Network.HTTP.Types
-import Data.Default
import qualified Data.CaseInsensitive as CI
import qualified Data.ByteString as B
import qualified Data.ByteString.UTF8 as B8