add: fix compilation with GHC 7.4 and perhaps older

This commit is contained in:
Simon Michael 2013-02-25 19:49:03 +00:00
parent 9ffb0b2d1f
commit 314da705f8

View File

@ -11,7 +11,7 @@ informational messages are mostly written to stderr rather than stdout.
module Hledger.Cli.Add module Hledger.Cli.Add
where where
import Control.Exception as C import Control.Exception as E
import Control.Monad import Control.Monad
import Control.Monad.Trans (liftIO) import Control.Monad.Trans (liftIO)
import Data.Char (toUpper) import Data.Char (toUpper)
@ -55,7 +55,7 @@ add opts j
let args = words' $ query_ $ reportopts_ opts let args = words' $ query_ $ reportopts_ opts
(defdate, moredefs) = headTailDef today args (defdate, moredefs) = headTailDef today args
getAndAddTransactionsLoop j opts defdate moredefs getAndAddTransactionsLoop j opts defdate moredefs
`C.catch` (\e -> unless (isEOFError e) $ ioError e) `E.catch` (\e -> unless (isEOFError e) $ ioError e)
where f = journalFilePath j where f = journalFilePath j
-- | Loop reading transactions from the console, prompting for, -- | Loop reading transactions from the console, prompting for,
@ -140,7 +140,7 @@ getPostingsForTransactionWithHistory j opts datestr code description comment def
retry msg = liftIO (hPutStrLn stderr $ "\n" ++ (capitalize msg) ++ "please re-enter.") >> getvalidpostings retry msg = liftIO (hPutStrLn stderr $ "\n" ++ (capitalize msg) ++ "please re-enter.") >> getvalidpostings
when (isJust bestmatch) $ liftIO $ hPrintf stderr "\nUsing this similar transaction for defaults:\n%s" (show $ fromJust bestmatch) when (isJust bestmatch) $ liftIO $ hPrintf stderr "\nUsing this similar transaction for defaults:\n%s" (show $ fromJust bestmatch)
getvalidpostings `catch` \(_::RestartEntryException) -> return Nothing getvalidpostings `E.catch` \(_::RestartEntryException) -> return Nothing
-- | Read postings from the command line until . is entered, generating -- | Read postings from the command line until . is entered, generating
-- useful defaults based on historical context and postings entered so far. -- useful defaults based on historical context and postings entered so far.
@ -239,7 +239,7 @@ askFor prompt def validator = do
where where
showdef "" = "" showdef "" = ""
showdef s = "[" ++ s ++ "]" showdef s = "[" ++ s ++ "]"
eofErr = C.throw $ mkIOError eofErrorType "end of input" Nothing Nothing eofErr = E.throw $ mkIOError eofErrorType "end of input" Nothing Nothing
-- | Append this transaction to the journal's file, and to the journal's -- | Append this transaction to the journal's file, and to the journal's
-- transaction list. -- transaction list.