summaryrefslogtreecommitdiff
path: root/Utility/HumanTime.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2020-05-04 15:38:39 -0400
committerJoey Hess <joeyh@joeyh.name>2020-05-04 15:38:39 -0400
commit8c4352a0a544b2e5a4ed717999fc7c6ecb0a328f (patch)
treed57aca56117598b06bf30e5a1ed96f4b77e51f09 /Utility/HumanTime.hs
parent6ea7eac330f73699d965cef7b8ee23d7218415a8 (diff)
downloadgit-repair-8c4352a0a544b2e5a4ed717999fc7c6ecb0a328f.tar.gz
merge from git-annex
* Improve fetching from a remote with an url in host:path format. * Merge from git-annex.
Diffstat (limited to 'Utility/HumanTime.hs')
-rw-r--r--Utility/HumanTime.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Utility/HumanTime.hs b/Utility/HumanTime.hs
index 01fbeac..d90143e 100644
--- a/Utility/HumanTime.hs
+++ b/Utility/HumanTime.hs
@@ -19,6 +19,7 @@ module Utility.HumanTime (
import Utility.PartialPrelude
import Utility.QuickCheck
+import Control.Monad.Fail as Fail (MonadFail(..))
import qualified Data.Map as M
import Data.Time.Clock
import Data.Time.Clock.POSIX (POSIXTime)
@@ -44,7 +45,7 @@ daysToDuration :: Integer -> Duration
daysToDuration i = Duration $ i * dsecs
{- Parses a human-input time duration, of the form "5h", "1m", "5h1m", etc -}
-parseDuration :: Monad m => String -> m Duration
+parseDuration :: MonadFail m => String -> m Duration
parseDuration = maybe parsefail (return . Duration) . go 0
where
go n [] = return n
@@ -55,7 +56,7 @@ parseDuration = maybe parsefail (return . Duration) . go 0
u <- M.lookup c unitmap
go (n + num * u) rest
_ -> return $ n + num
- parsefail = fail "duration parse error; expected eg \"5m\" or \"1h5m\""
+ parsefail = Fail.fail "duration parse error; expected eg \"5m\" or \"1h5m\""
fromDuration :: Duration -> String
fromDuration Duration { durationSeconds = d }