web: Fix compilation errors for all 'stack.yaml's
This commit is contained in:
parent
8d1ee38627
commit
466558968b
@ -21,7 +21,7 @@ import qualified Data.ByteString.Char8 as BC
|
||||
import Data.Traversable (for)
|
||||
import Data.IORef (IORef, readIORef, writeIORef)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Semigroup ((<>))
|
||||
import Data.Monoid ((<>))
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Time.Calendar (Day)
|
||||
|
||||
@ -13,7 +13,7 @@ import Data.ByteString as Import (ByteString)
|
||||
import Data.Default as Import
|
||||
import Data.Either as Import
|
||||
import Data.Foldable as Import
|
||||
import Data.List as Import (foldl', unfoldr)
|
||||
import Data.List as Import (unfoldr)
|
||||
import Data.Maybe as Import
|
||||
import Data.Text as Import (Text)
|
||||
import Data.Time as Import hiding (parseTime)
|
||||
|
||||
@ -25,7 +25,6 @@ import Yesod.Default.Main (defaultDevelApp)
|
||||
|
||||
import Hledger
|
||||
import Hledger.Cli hiding (progname,prognameandversion)
|
||||
import Hledger.Cli.Utils (journalTransform)
|
||||
import Hledger.Utils.UTF8IOCompat (putStrLn)
|
||||
import Hledger.Web.Application (makeApplication)
|
||||
import Hledger.Web.Settings (Extra(..), parseExtra)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE GADTs #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
@ -26,12 +27,14 @@ import Yesod
|
||||
import Hledger
|
||||
import Hledger.Web.Settings (widgetFile)
|
||||
|
||||
-- XXX <select> which journal to add to
|
||||
|
||||
addModal ::
|
||||
( MonadWidget m
|
||||
, r ~ Route (HandlerSite m)
|
||||
#if MIN_VERSION_yesod(1,6,0)
|
||||
, m ~ WidgetFor (HandlerSite m)
|
||||
#else
|
||||
, m ~ WidgetT (HandlerSite m) IO
|
||||
#endif
|
||||
, RenderMessage (HandlerSite m) FormMessage
|
||||
)
|
||||
=> r -> Journal -> Day -> m ()
|
||||
@ -54,7 +57,11 @@ addForm ::
|
||||
=> Journal
|
||||
-> Day
|
||||
-> Markup
|
||||
#if MIN_VERSION_yesod(1,6,0)
|
||||
-> MForm m (FormResult Transaction, WidgetFor site ())
|
||||
#else
|
||||
-> MForm m (FormResult Transaction, WidgetT site IO ())
|
||||
#endif
|
||||
addForm j today = identifyForm "add" $ \extra -> do
|
||||
(dateRes, dateView) <- mreq dateField dateFS Nothing
|
||||
(descRes, descView) <- mreq textField descFS Nothing
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
@ -32,16 +33,20 @@ import Hledger
|
||||
import Hledger.Cli.Utils (writeFileWithBackupIfChanged)
|
||||
import Hledger.Web.Settings (manualurl)
|
||||
|
||||
#if MIN_VERSION_yesod(1,6,0)
|
||||
journalFile404 :: FilePath -> Journal -> HandlerFor m (FilePath, Text)
|
||||
#else
|
||||
journalFile404 :: FilePath -> Journal -> HandlerT m IO (FilePath, Text)
|
||||
#endif
|
||||
journalFile404 f j =
|
||||
case find ((== f) . fst) (jfiles j) of
|
||||
Just (_, txt) -> pure (takeFileName f, txt)
|
||||
Nothing -> notFound
|
||||
|
||||
fromFormSuccess :: HandlerFor m a -> FormResult a -> HandlerFor m a
|
||||
fromFormSuccess :: Applicative m => m a -> FormResult a -> m a
|
||||
fromFormSuccess h FormMissing = h
|
||||
fromFormSuccess h (FormFailure _) = h
|
||||
fromFormSuccess _ (FormSuccess a) = return a
|
||||
fromFormSuccess _ (FormSuccess a) = pure a
|
||||
|
||||
writeValidJournal :: MonadHandler m => FilePath -> Text -> m (Either String ())
|
||||
writeValidJournal f txt =
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 830642fdd094b9838924e2e3865481d8bc65afb314152d5afafe2207c3d5a9a8
|
||||
-- hash: 541d9fc4104cd8cdcda3b38d002fbf354769af5b4f46e7b12ec1f0a70f452b12
|
||||
|
||||
name: hledger-web
|
||||
version: 1.9.99
|
||||
@ -136,21 +136,19 @@ library
|
||||
Hledger.Web.Handler.AddR
|
||||
Hledger.Web.Handler.Common
|
||||
Hledger.Web.Handler.EditR
|
||||
Hledger.Web.Handler.ImportR
|
||||
Hledger.Web.Handler.JournalR
|
||||
Hledger.Web.Handler.RegisterR
|
||||
Hledger.Web.Handler.UploadR
|
||||
Hledger.Web.Import
|
||||
Hledger.Web.Main
|
||||
Hledger.Web.Settings
|
||||
Hledger.Web.Settings.Development
|
||||
Hledger.Web.Settings.StaticFiles
|
||||
Hledger.Web.WebOptions
|
||||
Hledger.Web.Widget.AddForm
|
||||
Hledger.Web.Widget.Common
|
||||
other-modules:
|
||||
Paths_hledger_web
|
||||
ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints -fwarn-tabs
|
||||
ghc-options: -Wall -fwarn-tabs
|
||||
cpp-options: -DVERSION="1.9.99"
|
||||
build-depends:
|
||||
HUnit
|
||||
@ -174,6 +172,7 @@ library
|
||||
, json
|
||||
, megaparsec >=6.4.1
|
||||
, mtl
|
||||
, semigroups
|
||||
, shakespeare >=2.0.2.2
|
||||
, template-haskell
|
||||
, text >=1.2
|
||||
@ -200,10 +199,11 @@ executable hledger-web
|
||||
Paths_hledger_web
|
||||
hs-source-dirs:
|
||||
app
|
||||
ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints -fwarn-tabs
|
||||
ghc-options: -Wall -fwarn-tabs
|
||||
cpp-options: -DVERSION="1.9.99"
|
||||
build-depends:
|
||||
hledger-web
|
||||
base
|
||||
, hledger-web
|
||||
if (flag(dev)) || (flag(library-only))
|
||||
cpp-options: -DDEVELOPMENT
|
||||
if flag(dev)
|
||||
@ -223,10 +223,11 @@ test-suite test
|
||||
Paths_hledger_web
|
||||
hs-source-dirs:
|
||||
tests
|
||||
ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints -fwarn-tabs
|
||||
ghc-options: -Wall -fwarn-tabs
|
||||
cpp-options: -DVERSION="1.9.99"
|
||||
build-depends:
|
||||
hledger-web
|
||||
base
|
||||
, hledger-web
|
||||
, hspec
|
||||
, yesod-test
|
||||
if (flag(dev)) || (flag(library-only))
|
||||
|
||||
@ -66,11 +66,12 @@ when:
|
||||
|
||||
ghc-options:
|
||||
- -Wall
|
||||
- -Wcompat
|
||||
- -Wincomplete-uni-patterns
|
||||
- -Wincomplete-record-updates
|
||||
- -Wredundant-constraints
|
||||
- -fwarn-tabs
|
||||
#XXX to be reenabled once 7.6.3 support is dropped:
|
||||
#- -Wcompat
|
||||
#- -Wincomplete-uni-patterns
|
||||
#- -Wincomplete-record-updates
|
||||
#- -Wredundant-constraints
|
||||
|
||||
library:
|
||||
source-dirs: .
|
||||
@ -82,14 +83,12 @@ library:
|
||||
- Hledger.Web.Handler.AddR
|
||||
- Hledger.Web.Handler.Common
|
||||
- Hledger.Web.Handler.EditR
|
||||
- Hledger.Web.Handler.ImportR
|
||||
- Hledger.Web.Handler.JournalR
|
||||
- Hledger.Web.Handler.RegisterR
|
||||
- Hledger.Web.Handler.UploadR
|
||||
- Hledger.Web.Import
|
||||
- Hledger.Web.Main
|
||||
- Hledger.Web.Settings
|
||||
- Hledger.Web.Settings.Development
|
||||
- Hledger.Web.Settings.StaticFiles
|
||||
- Hledger.Web.WebOptions
|
||||
- Hledger.Web.Widget.AddForm
|
||||
@ -115,6 +114,7 @@ library:
|
||||
- json
|
||||
- megaparsec >=6.4.1
|
||||
- mtl
|
||||
- semigroups
|
||||
- shakespeare >=2.0.2.2
|
||||
- template-haskell
|
||||
- text >=1.2
|
||||
@ -137,6 +137,7 @@ executables:
|
||||
main: main.hs
|
||||
cpp-options: -DVERSION="1.9.99"
|
||||
dependencies:
|
||||
- base
|
||||
- hledger-web
|
||||
when:
|
||||
- condition: flag(library-only)
|
||||
@ -150,6 +151,7 @@ tests:
|
||||
main: main.hs
|
||||
cpp-options: -DVERSION="1.9.99"
|
||||
dependencies:
|
||||
- base
|
||||
- hledger-web
|
||||
- hspec
|
||||
- yesod-test
|
||||
|
||||
Loading…
Reference in New Issue
Block a user