mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 20:02:27 +03:00
;deps: a better fix for nubSortBy with ghc 7.10, 8.0
nubSortBy and nub . sortBy are not equivalent, it seems. I didn't notice the failing valuation func tests.
This commit is contained in:
parent
87ab586629
commit
6f2f8d7638
@ -27,7 +27,7 @@ import Data.Decimal (roundTo)
|
||||
import Data.Function (on)
|
||||
import Data.Graph.Inductive (Gr, Node, NodeMap, mkMapGraph, mkNode, lab, out, sp)
|
||||
import Data.List
|
||||
-- import Data.List.Extra (nubSortBy)
|
||||
import Data.List.Extra (nubSortBy)
|
||||
import qualified Data.Map as M
|
||||
import Data.Maybe
|
||||
import qualified Data.Text as T
|
||||
@ -120,9 +120,7 @@ pricesAtDate pricedirectives d = PriceGraph{prGraph=g, prNodemap=m, prDeclaredPa
|
||||
-- get the latest (on or before date d) declared price for each commodity pair
|
||||
declaredprices :: [MarketPrice] =
|
||||
dbg5 "declaredprices" $
|
||||
-- XXX Data.List.Extra.nubSortBy might be more efficient (n Log n vs n^2 ?)
|
||||
-- but is not in ghc 7.10, 8.0 stackage snapshots
|
||||
nub $ sortBy (compare `on` (\(MarketPrice{..})->(mpfrom,mpto))) $ -- keep only the first (ie newest and latest parsed) price for each pair
|
||||
nubSortBy (compare `on` (\(MarketPrice{..})->(mpfrom,mpto))) $ -- keep only the first (ie newest and latest parsed) price for each pair
|
||||
map snd $ -- discard the parse order label
|
||||
sortBy (flip compare `on` (\(parseorder,mp)->(mpdate mp,parseorder))) $ -- sort with newest dates and latest parse order first
|
||||
zip [1..] $ -- label with parse order
|
||||
|
@ -4,7 +4,7 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 940be6dde18cf33cca2096d9176100b9ba178418eea2f1427d94fc5ffe58e783
|
||||
-- hash: 4cfc4e9879ec711800e91c2cfe108a99c36d80ccb81b59e1df314915e94d5523
|
||||
|
||||
name: hledger-lib
|
||||
version: 1.14.99
|
||||
@ -120,7 +120,7 @@ library
|
||||
, deepseq
|
||||
, directory
|
||||
, easytest >=0.2.1 && <0.3
|
||||
, extra
|
||||
, extra >=1.6.3
|
||||
, fgl >=5.5.4.0
|
||||
, file-embed >=0.0.10
|
||||
, filepath
|
||||
@ -223,7 +223,7 @@ test-suite doctests
|
||||
, directory
|
||||
, doctest >=0.16
|
||||
, easytest >=0.2.1 && <0.3
|
||||
, extra
|
||||
, extra >=1.6.3
|
||||
, fgl >=5.5.4.0
|
||||
, file-embed >=0.0.10
|
||||
, filepath
|
||||
@ -325,7 +325,7 @@ test-suite easytests
|
||||
, deepseq
|
||||
, directory
|
||||
, easytest >=0.2.1 && <0.3
|
||||
, extra
|
||||
, extra >=1.6.3
|
||||
, fgl >=5.5.4.0
|
||||
, file-embed >=0.0.10
|
||||
, filepath
|
||||
|
@ -76,7 +76,7 @@ dependencies:
|
||||
- transformers >=0.2
|
||||
- uglymemo
|
||||
- utf8-string >=0.3.5
|
||||
- extra
|
||||
- extra >=1.6.3
|
||||
- Glob >= 0.9
|
||||
# for ledger-parse:
|
||||
#- parsers >=0.5
|
||||
|
@ -35,6 +35,7 @@ extra-deps:
|
||||
- directory-1.2.7.0
|
||||
- doctest-0.16.0
|
||||
- exceptions-0.10.0
|
||||
- extra-1.6.17
|
||||
- fgl-5.5.4.0
|
||||
- free-5.0.2
|
||||
- generics-sop-0.3.2.0
|
||||
|
@ -24,6 +24,7 @@ extra-deps:
|
||||
- config-ini-0.2.3.0
|
||||
- criterion-1.4.1.0
|
||||
- doctest-0.16.0
|
||||
- extra-1.6.17
|
||||
- fgl-5.5.4.0
|
||||
- generics-sop-0.3.2.0
|
||||
- hashable-1.2.7.0
|
||||
|
Loading…
Reference in New Issue
Block a user