OsPath build flag no longer depends on filepath-bytestring
However, filepath-bytestring is still in Setup-Depends. That's because Utility.OsPath uses it when not built with OsPath. It would be maybe possible to make Utility.OsPath fall back to using filepath, and eliminate that dependency too, but it would mean either wrapping all of System.FilePath's functions, or using `type OsPath = FilePath` Annex.Import uses ifdefs to avoid converting back to FilePath when not on windows. On windows it's a bit slower due to that conversion. Utility.Path.Windows.convertToWindowsNativeNamespace got a bit slower too, but not really worth optimising I think. Note that importing Utility.FileSystemEncoding at the same time as System.Posix.ByteString will result in conflicting definitions for RawFilePath. filepath-bytestring avoids that by importing RawFilePath from System.Posix.ByteString, but that's not possible in Utility.FileSystemEncoding, since Setup-Depends does not include unix. This turned out not to affect any code in git-annex though. Sponsored-by: Leon Schuermann
This commit is contained in:
parent
ce697aa8ae
commit
2ff716be30
13 changed files with 81 additions and 68 deletions
|
@ -38,7 +38,7 @@ module Database.RawFilePath where
|
|||
#if MIN_VERSION_persistent_sqlite(2,13,3)
|
||||
import Database.Persist.Sqlite
|
||||
import qualified Database.Sqlite as Sqlite
|
||||
import qualified System.FilePath.ByteString as P
|
||||
import Utility.RawFilePath (RawFilePath)
|
||||
import qualified Control.Exception as E
|
||||
import Control.Monad.Logger (MonadLoggerIO)
|
||||
import Control.Monad.IO.Unlift (MonadUnliftIO)
|
||||
|
@ -47,7 +47,7 @@ import Control.Monad.Trans.Reader (ReaderT)
|
|||
import UnliftIO.Resource (ResourceT, runResourceT)
|
||||
|
||||
openWith'
|
||||
:: P.RawFilePath
|
||||
:: RawFilePath
|
||||
-> (SqlBackend -> Sqlite.Connection -> r)
|
||||
-> SqliteConnectionInfo
|
||||
-> LogFunc
|
||||
|
@ -58,7 +58,7 @@ openWith' db f connInfo logFunc = do
|
|||
return $ f backend conn
|
||||
|
||||
runSqlite' :: (MonadUnliftIO m)
|
||||
=> P.RawFilePath
|
||||
=> RawFilePath
|
||||
-> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a
|
||||
-> m a
|
||||
runSqlite' connstr = runResourceT
|
||||
|
@ -68,7 +68,7 @@ runSqlite' connstr = runResourceT
|
|||
|
||||
withSqliteConn'
|
||||
:: (MonadUnliftIO m, MonadLoggerIO m)
|
||||
=> P.RawFilePath
|
||||
=> RawFilePath
|
||||
-> (SqlBackend -> m a)
|
||||
-> m a
|
||||
withSqliteConn' connstr = withSqliteConnInfo' connstr $
|
||||
|
@ -76,7 +76,7 @@ withSqliteConn' connstr = withSqliteConnInfo' connstr $
|
|||
|
||||
runSqliteInfo'
|
||||
:: (MonadUnliftIO m)
|
||||
=> P.RawFilePath
|
||||
=> RawFilePath
|
||||
-> SqliteConnectionInfo
|
||||
-> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a
|
||||
-> m a
|
||||
|
@ -87,7 +87,7 @@ runSqliteInfo' db conInfo = runResourceT
|
|||
|
||||
withSqliteConnInfo'
|
||||
:: (MonadUnliftIO m, MonadLoggerIO m)
|
||||
=> P.RawFilePath
|
||||
=> RawFilePath
|
||||
-> SqliteConnectionInfo
|
||||
-> (SqlBackend -> m a)
|
||||
-> m a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue