diff --git a/hledger-lib/Hledger/Data/Dates.hs b/hledger-lib/Hledger/Data/Dates.hs index df756a575..60ae4e25f 100644 --- a/hledger-lib/Hledger/Data/Dates.hs +++ b/hledger-lib/Hledger/Data/Dates.hs @@ -713,7 +713,7 @@ Right ("201813","","") A 9+ digit number beginning with valid YYYYMMDD gives an error: >>> parsewith (smartdate <* eof) "201801012" -Left (TrivialError (SourcePos {sourceName = "", sourceLine = Pos 1, sourceColumn = Pos 9} :| []) (Just (Tokens ('2' :| ""))) (fromList [EndOfInput])) +Left (...) Big numbers not beginning with a valid YYYYMMDD are parsed as a year: >>> parsewith (smartdate <* eof) "201813012" diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 72137d22b..ecb2492b5 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -105,7 +105,8 @@ import Data.Time.Calendar import Data.Time.LocalTime import Safe import System.Time (getClockTime) -import Text.Megaparsec.Compat +import Text.Megaparsec.Compat hiding (skipManyTill) +import Control.Applicative.Combinators (skipManyTill) import Hledger.Data import Hledger.Utils diff --git a/hledger-lib/hledger-lib.cabal b/hledger-lib/hledger-lib.cabal index daf73e2b2..76eba17db 100644 --- a/hledger-lib/hledger-lib.cabal +++ b/hledger-lib/hledger-lib.cabal @@ -123,6 +123,7 @@ library , mtl-compat , old-time , parsec >=3 + , parser-combinators , pretty-show >=1.6.4 , regex-tdfa , safe >=0.2 @@ -219,6 +220,7 @@ test-suite doctests , mtl-compat , old-time , parsec >=3 + , parser-combinators , pretty-show >=1.6.4 , regex-tdfa , safe >=0.2 @@ -317,6 +319,7 @@ test-suite easytests , mtl-compat , old-time , parsec >=3 + , parser-combinators , pretty-show >=1.6.4 , regex-tdfa , safe >=0.2 @@ -412,6 +415,7 @@ test-suite hunittests , mtl-compat , old-time , parsec >=3 + , parser-combinators , pretty-show >=1.6.4 , regex-tdfa , safe >=0.2 diff --git a/hledger-lib/package.yaml b/hledger-lib/package.yaml index 2888a4b5c..0ea4d08b5 100644 --- a/hledger-lib/package.yaml +++ b/hledger-lib/package.yaml @@ -59,6 +59,7 @@ dependencies: - mtl-compat - old-time - parsec >=3 +- parser-combinators - pretty-show >=1.6.4 - regex-tdfa - safe >=0.2 diff --git a/hledger/Hledger/Cli/Utils.hs b/hledger/Hledger/Cli/Utils.hs index 671865256..c3e2eee84 100644 --- a/hledger/Hledger/Cli/Utils.hs +++ b/hledger/Hledger/Cli/Utils.hs @@ -29,7 +29,6 @@ module Hledger.Cli.Utils where import Control.Exception as C import Control.Monad -import Data.Functor.Compat ((<&>)) import Data.Hashable (hash) import Data.List @@ -82,10 +81,10 @@ withJournalDo opts cmd = do -- - anonymising (--anonymise). journalTransform :: CliOpts -> Journal -> IO Journal journalTransform opts@CliOpts{reportopts_=ropts} = - ( journalAddForecast opts - >=> journalApplyValue ropts) - <&> (pivotByOpts opts <$>) - <&> (anonymiseByOpts opts <$>) + journalAddForecast opts + >=> journalApplyValue ropts + >=> return . pivotByOpts opts + >=> return . anonymiseByOpts opts -- | Apply the pivot transformation on a journal, if option is present. pivotByOpts :: CliOpts -> Journal -> Journal diff --git a/stack-ghc8.0.yaml b/stack-ghc8.0.yaml index e3c050488..393005cd7 100644 --- a/stack-ghc8.0.yaml +++ b/stack-ghc8.0.yaml @@ -10,4 +10,4 @@ packages: - hledger-api extra-deps: - [] +- easytest-0.1