From ae2fdbf72745ac46116c70f8435dacd7c227225f Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 20 May 2024 19:51:34 +0200 Subject: use OsPath instead of FilePath in easy cases this is still far from being supported by most libraries, but does make it possible to remove some uses of String (though most times, there is a conversion back to String later). Note that using the default.nix now only works on nixpkgs-unstable for a bit; using the newer filepath package on stable leads to broken other packages. --- lib/Config.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/Config.hs') diff --git a/lib/Config.hs b/lib/Config.hs index 4aa62fc..ef90fc1 100644 --- a/lib/Config.hs +++ b/lib/Config.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} module Config (UffdConfig(..), ServerConfig(..), LoggingConfig(..)) where @@ -9,6 +10,7 @@ import Data.Functor ((<&>)) import Data.Text (Text) import GHC.Generics (Generic) import Network.Wai.Handler.Warp (Settings) +import System.OsPath (OsPath, osp) import URI.ByteString data UffdConfig = UffdConfig @@ -21,9 +23,9 @@ data UffdConfig = UffdConfig data ServerConfig = ServerConfig { serverConfigWarp :: Settings , serverConfigDbString :: ByteString - , serverConfigGtfs :: FilePath - , serverConfigAssets :: FilePath - , serverConfigZoneinfoPath :: FilePath + , serverConfigGtfs :: OsPath + , serverConfigAssets :: OsPath + , serverConfigZoneinfoPath :: OsPath , serverConfigDebugMode :: Bool , serverConfigLogin :: UffdConfig , serverConfigLogging :: LoggingConfig @@ -41,9 +43,9 @@ instance DefaultConfig ServerConfig where configDef = ServerConfig { serverConfigWarp = configDef , serverConfigDbString = "" - , serverConfigGtfs = "./gtfs.zip" - , serverConfigAssets = "./assets" - , serverConfigZoneinfoPath = "/etc/zoneinfo/" + , serverConfigGtfs = [osp|./gtfs.zip|] + , serverConfigAssets = [osp|./assets|] + , serverConfigZoneinfoPath = [osp|/etc/zoneinfo/|] , serverConfigDebugMode = False , serverConfigLogin = configDef , serverConfigLogging = configDef -- cgit v1.2.3