diff --git a/hledger-web/Application.hs b/hledger-web/Application.hs index 10872e043..9a081369c 100644 --- a/hledger-web/Application.hs +++ b/hledger-web/Application.hs @@ -13,6 +13,7 @@ import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger (logStdoutDev, logStdout) import Network.HTTP.Conduit (newManager) +import Prelude (head) -- adapt to http-conduit 1.x or 2.x when cabal macros are available, otherwise assume 2.x #ifdef MIN_VERSION_http_conduit @@ -77,7 +78,7 @@ makeFoundation conf = do -- uses the journal specified by the LEDGER_FILE env var, or ~/.hledger.journal getApplicationDev :: IO (Int, Application) getApplicationDev = do - f <- journalFilePathFromOpts defcliopts + f <- head `fmap` journalFilePathFromOpts defcliopts -- XXX head should be safe for now j <- either error' id `fmap` readJournalFile Nothing Nothing True f defaultDevelApp loader (makeApplication defwebopts j) where diff --git a/hledger-web/Hledger/Web/Main.hs b/hledger-web/Hledger/Web/Main.hs index 279315cb0..e3fce2a2c 100644 --- a/hledger-web/Hledger/Web/Main.hs +++ b/hledger-web/Hledger/Web/Main.hs @@ -47,12 +47,13 @@ runWith opts | "version" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn prognameandversion >> exitSuccess | "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname) | otherwise = do - requireJournalFileExists =<< journalFilePathFromOpts (cliopts_ opts) + requireJournalFileExists =<< (head `fmap` journalFilePathFromOpts (cliopts_ opts)) -- XXX head should be safe for now withJournalDo' opts web withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO () withJournalDo' opts cmd = do - journalFilePathFromOpts (cliopts_ opts) >>= readJournalFile Nothing Nothing True >>= + -- XXX head should be safe for now + (head `fmap` journalFilePathFromOpts (cliopts_ opts)) >>= readJournalFile Nothing Nothing True >>= either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts)) -- | The web command.