diff --git a/hledger-lib/Hledger/Utils.hs b/hledger-lib/Hledger/Utils.hs index 04ef9ac69..a5c030c3f 100644 --- a/hledger-lib/Hledger/Utils.hs +++ b/hledger-lib/Hledger/Utils.hs @@ -29,7 +29,7 @@ module Hledger.Utils (---- provide these frequently used modules - or not, for c -- Debug.Trace.trace, -- module Data.PPrint, -- module Hledger.Utils.UTF8IOCompat - SystemString,fromSystemString,toSystemString,error',userError',usageError, + error',userError',usageError, -- the rest need to be done in each module I think ) where @@ -66,7 +66,7 @@ import Hledger.Utils.Color import Hledger.Utils.Tree -- import Prelude hiding (readFile,writeFile,appendFile,getContents,putStr,putStrLn) -- import Hledger.Utils.UTF8IOCompat (readFile,writeFile,appendFile,getContents,putStr,putStrLn) -import Hledger.Utils.UTF8IOCompat (SystemString,fromSystemString,toSystemString,error',userError',usageError) +import Hledger.Utils.UTF8IOCompat (error',userError',usageError) -- tuples diff --git a/hledger-lib/Hledger/Utils/UTF8IOCompat.hs b/hledger-lib/Hledger/Utils/UTF8IOCompat.hs index 517c32d81..4f697f6b1 100644 --- a/hledger-lib/Hledger/Utils/UTF8IOCompat.hs +++ b/hledger-lib/Hledger/Utils/UTF8IOCompat.hs @@ -15,6 +15,9 @@ Example usage: do the right thing, so this file is a no-op and on its way to being removed. Not carefully tested. +2019/10/20 update: all packages have base>=4.9 which corresponds to GHC v8.0.1 +and higher. Tear this file apart! + -} -- TODO obsolete ? @@ -29,9 +32,6 @@ module Hledger.Utils.UTF8IOCompat ( hPutStr, hPutStrLn, -- - SystemString, - fromSystemString, - toSystemString, error', userError', usageError, @@ -85,37 +85,19 @@ import System.IO -- (Handle) -- bs_hPutStr = B8.hPut -- bs_hPutStrLn h bs = B8.hPut h bs >> B8.hPut h (B.singleton 0x0a) - --- | A string received from or being passed to the operating system, such --- as a file path, command-line argument, or environment variable name or --- value. With GHC versions before 7.2 on some platforms (posix) these are --- typically encoded. When converting, we assume the encoding is UTF-8 (cf --- ). -type SystemString = String - --- | Convert a system string to an ordinary string, decoding from UTF-8 if --- it appears to be UTF8-encoded and GHC version is less than 7.2. -fromSystemString :: SystemString -> String -fromSystemString = id - --- | Convert a unicode string to a system string, encoding with UTF-8 if --- we are on a posix platform with GHC < 7.2. -toSystemString :: String -> SystemString -toSystemString = id - -- | A SystemString-aware version of error. error' :: String -> a error' = #if __GLASGOW_HASKELL__ < 800 -- (easier than if base < 4.9) - error . toSystemString + error #else - errorWithoutStackTrace . toSystemString + errorWithoutStackTrace #endif -- | A SystemString-aware version of userError. userError' :: String -> IOError -userError' = userError . toSystemString +userError' = userError -- | A SystemString-aware version of error that adds a usage hint. usageError :: String -> a diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index 51391b5d8..90262c2ee 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -396,7 +396,7 @@ defcliopts = CliOpts -- | Convert possibly encoded option values to regular unicode strings. decodeRawOpts :: RawOpts -> RawOpts -decodeRawOpts = map (\(name',val) -> (name', fromSystemString val)) +decodeRawOpts = id -- TODO: drop usage of this -- | Default width for hledger console output, when not otherwise specified. defaultWidth :: Int