more RawFilePath conversion
This commit was sponsored by Luke Shumaker on Patreon.
This commit is contained in:
parent
b724236b35
commit
55400a03d3
22 changed files with 91 additions and 79 deletions
|
@ -134,7 +134,8 @@ fromRemotes repo = mapM construct remotepairs
|
|||
filterconfig f = filter f $ M.toList $ config repo
|
||||
filterkeys f = filterconfig (\(k,_) -> f k)
|
||||
remotepairs = filterkeys isRemoteKey
|
||||
construct (k,v) = remoteNamedFromKey k (fromRemoteLocation (fromConfigValue v) repo)
|
||||
construct (k,v) = remoteNamedFromKey k $
|
||||
fromRemoteLocation (fromConfigValue v) repo
|
||||
|
||||
{- Sets the name of a remote when constructing the Repo to represent it. -}
|
||||
remoteNamed :: String -> IO Repo -> IO Repo
|
||||
|
|
14
Git/Types.hs
14
Git/Types.hs
|
@ -5,7 +5,7 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-}
|
||||
|
||||
module Git.Types where
|
||||
|
||||
|
@ -79,9 +79,15 @@ fromConfigKey (ConfigKey s) = decodeBS' s
|
|||
instance Show ConfigKey where
|
||||
show = fromConfigKey
|
||||
|
||||
fromConfigValue :: ConfigValue -> String
|
||||
fromConfigValue (ConfigValue s) = decodeBS' s
|
||||
fromConfigValue NoConfigValue = mempty
|
||||
class FromConfigValue a where
|
||||
fromConfigValue :: ConfigValue -> a
|
||||
|
||||
instance FromConfigValue S.ByteString where
|
||||
fromConfigValue (ConfigValue s) = s
|
||||
fromConfigValue NoConfigValue = mempty
|
||||
|
||||
instance FromConfigValue String where
|
||||
fromConfigValue = decodeBS' . fromConfigValue
|
||||
|
||||
instance Show ConfigValue where
|
||||
show = fromConfigValue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue