diff --git a/Commands/Add.hs b/Commands/Add.hs index c058f88a5..299d82053 100644 --- a/Commands/Add.hs +++ b/Commands/Add.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| A history-aware add command to help with data entry. @@ -6,12 +7,16 @@ A history-aware add command to help with data entry. module Commands.Add where -import Prelude hiding (putStr, putStrLn, getLine, appendFile) import Ledger import Options import Commands.Register (showRegisterReport) +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding (putStr, putStrLn, getLine, appendFile) import System.IO.UTF8 -import System.IO (stderr, hFlush) +import System.IO ( stderr, hFlush ) +#else +import System.IO ( stderr, hFlush, hPutStrLn, hPutStr ) +#endif import System.IO.Error import Text.ParserCombinators.Parsec import Utils (ledgerFromStringWithOpts) @@ -24,9 +29,9 @@ add :: [Opt] -> [String] -> Ledger -> IO () add opts args l | filepath (journal l) == "-" = return () | otherwise = do - hPutStrLn stderr - "Enter one or more transactions, which will be added to your ledger file.\n\ - \To complete a transaction, enter . as account name. To quit, press control-c." + hPutStrLn stderr $ + "Enter one or more transactions, which will be added to your ledger file.\n" + ++"To complete a transaction, enter . as account name. To quit, press control-c." today <- getCurrentDay getAndAddTransactions l opts args today `catch` (\e -> unless (isEOFError e) $ ioError e) diff --git a/Commands/Balance.hs b/Commands/Balance.hs index 9cc61f745..40bef7ddd 100644 --- a/Commands/Balance.hs +++ b/Commands/Balance.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| A ledger-compatible @balance@ command. @@ -96,7 +97,6 @@ balance report: module Commands.Balance where -import Prelude hiding (putStr) import Ledger.Utils import Ledger.Types import Ledger.Amount @@ -104,7 +104,10 @@ import Ledger.AccountName import Ledger.Posting import Ledger.Ledger import Options +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding ( putStr ) import System.IO.UTF8 +#endif -- | Print a balance report. diff --git a/Commands/Histogram.hs b/Commands/Histogram.hs index ae8d7ad27..f4437e0c4 100644 --- a/Commands/Histogram.hs +++ b/Commands/Histogram.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| Print a histogram report. @@ -6,10 +7,12 @@ Print a histogram report. module Commands.Histogram where -import Prelude hiding (putStr) import Ledger import Options +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding ( putStr ) import System.IO.UTF8 +#endif barchar = '*' diff --git a/Commands/Print.hs b/Commands/Print.hs index 886873ae8..31d28d3a2 100644 --- a/Commands/Print.hs +++ b/Commands/Print.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| A ledger-compatible @print@ command. @@ -6,10 +7,12 @@ A ledger-compatible @print@ command. module Commands.Print where -import Prelude hiding (putStr) import Ledger import Options +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding ( putStr ) import System.IO.UTF8 +#endif -- | Print ledger transactions in standard format. diff --git a/Commands/Register.hs b/Commands/Register.hs index da985d7dd..a6b3e2488 100644 --- a/Commands/Register.hs +++ b/Commands/Register.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| A ledger-compatible @register@ command. @@ -6,10 +7,12 @@ A ledger-compatible @register@ command. module Commands.Register where -import Prelude hiding (putStr) import Ledger import Options +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding ( putStr ) import System.IO.UTF8 +#endif -- | Print a register report. diff --git a/Commands/Stats.hs b/Commands/Stats.hs index 4c477b60c..744c60b9a 100644 --- a/Commands/Stats.hs +++ b/Commands/Stats.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| Print some statistics for the ledger. @@ -6,10 +7,12 @@ Print some statistics for the ledger. module Commands.Stats where -import Prelude hiding (putStr) import Ledger import Options +#if __GLASGOW_HASKELL__ <= 610 +import Prelude hiding ( putStr ) import System.IO.UTF8 +#endif -- | Print various statistics for the ledger. diff --git a/Commands/Web.hs b/Commands/Web.hs index 0bed87612..3dc33cbf1 100644 --- a/Commands/Web.hs +++ b/Commands/Web.hs @@ -6,7 +6,9 @@ A web-based UI. module Commands.Web where +#if __GLASGOW_HASKELL__ <= 610 import Codec.Binary.UTF8.String (decodeString) +#endif import Control.Applicative.Error (Failing(Success,Failure)) import Control.Concurrent import Control.Monad.Reader (ask) @@ -50,7 +52,7 @@ import Commands.Register import Ledger import Utils (openBrowserOn) import Ledger.IO (readLedger) - +# -- import Debug.Trace -- strace :: Show a => a -> a -- strace a = trace (show a) a @@ -244,8 +246,13 @@ searchform env = do addform :: Hack.Env -> HSP XML addform env = do let inputs = Hack.Contrib.Request.inputs env +#if __GLASGOW_HASKELL__ <= 610 date = decodeString $ fromMaybe "" $ lookup "date" inputs desc = decodeString $ fromMaybe "" $ lookup "desc" inputs +#else + date = fromMaybe "" $ lookup "date" inputs + desc = fromMaybe "" $ lookup "desc" inputs +#endif