@@ -27,6 +27,7 @@ import Data.Maybe (isJust)
2727import qualified Data.Text as T
2828import qualified Data.Text.Encoding as T
2929import Data.Typeable (TypeRep, Typeable, cast, typeOf)
30+import Numeric (showHex)
3031import System.Directory (createDirectoryIfMissing)
3132import System.Directory (doesFileExist, removeFile)
3233import System.FilePath ((</>))
@@ -193,5 +194,8 @@ deleteFile = handle (\(_ :: IOException) -> return ()) . removeFile
193194--------------------------------------------------------------------------------
194195-- | Mostly meant for internal usage
195196hash :: [String] -> String
196−hash = concatMap (printf "%02x") . B.unpack .
197− MD5.hash . T.encodeUtf8 . T.pack . intercalate "/"
197+hash = toHex . B.unpack . MD5.hash . T.encodeUtf8 . T.pack . intercalate "/"
198+ where
199+ toHex [] = ""
200+ toHex (x : xs) | x < 16 = '0' : showHex x (toHex xs)
201+ | otherwise = showHex x (toHex xs)