web: fix build breakage from #165 (fixes #268)

This commit is contained in:
Simon Michael 2015-06-04 09:44:58 -07:00
parent ce5d87177a
commit bb8918a709
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import Yesod.Default.Main
import Yesod.Default.Handlers import Yesod.Default.Handlers
import Network.Wai.Middleware.RequestLogger (logStdoutDev, logStdout) import Network.Wai.Middleware.RequestLogger (logStdoutDev, logStdout)
import Network.HTTP.Conduit (newManager) 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 -- adapt to http-conduit 1.x or 2.x when cabal macros are available, otherwise assume 2.x
#ifdef MIN_VERSION_http_conduit #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 -- uses the journal specified by the LEDGER_FILE env var, or ~/.hledger.journal
getApplicationDev :: IO (Int, Application) getApplicationDev :: IO (Int, Application)
getApplicationDev = do 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 j <- either error' id `fmap` readJournalFile Nothing Nothing True f
defaultDevelApp loader (makeApplication defwebopts j) defaultDevelApp loader (makeApplication defwebopts j)
where where

View File

@ -47,12 +47,13 @@ runWith opts
| "version" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn prognameandversion >> exitSuccess | "version" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn prognameandversion >> exitSuccess
| "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname) | "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname)
| otherwise = do | otherwise = do
requireJournalFileExists =<< journalFilePathFromOpts (cliopts_ opts) requireJournalFileExists =<< (head `fmap` journalFilePathFromOpts (cliopts_ opts)) -- XXX head should be safe for now
withJournalDo' opts web withJournalDo' opts web
withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO () withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO ()
withJournalDo' opts cmd = do 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)) either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts))
-- | The web command. -- | The web command.