roi: use math-functions lib instead of old statistics version
This commit is contained in:
parent
e727f24df6
commit
3a5df72331
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE QuasiQuotes,ParallelListComp #-}
|
{-# LANGUAGE QuasiQuotes,ParallelListComp,CPP #-}
|
||||||
{-|
|
{-|
|
||||||
|
|
||||||
The @roi@ command prints internal rate of return and time-weighted rate of return for and investment.
|
The @roi@ command prints internal rate of return and time-weighted rate of return for and investment.
|
||||||
@ -17,7 +17,7 @@ import Text.Printf
|
|||||||
import Data.Function (on)
|
import Data.Function (on)
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Ord
|
import Data.Ord
|
||||||
import Statistics.Math.RootFinding
|
import Numeric.RootFinding
|
||||||
import Data.Decimal
|
import Data.Decimal
|
||||||
import Data.String.Here
|
import Data.String.Here
|
||||||
import System.Console.CmdArgs.Explicit as CmdArgs
|
import System.Console.CmdArgs.Explicit as CmdArgs
|
||||||
@ -216,7 +216,13 @@ internalRateOfReturn showCashFlow prettyTables (OneSpan spanBegin spanEnd valueB
|
|||||||
(map ((:[]) . show) amounts))
|
(map ((:[]) . show) amounts))
|
||||||
|
|
||||||
-- 0% is always a solution, so require at least something here
|
-- 0% is always a solution, so require at least something here
|
||||||
case ridders 0.00001 (0.000000000001,10000) (interestSum spanEnd totalCF) of
|
case ridders
|
||||||
|
#if MIN_VERSION_math_functions(0,3,0)
|
||||||
|
(RiddersParam 100 (AbsTol 0.00001))
|
||||||
|
#else
|
||||||
|
0.00001
|
||||||
|
#endif
|
||||||
|
(0.000000000001,10000) (interestSum spanEnd totalCF) of
|
||||||
Root rate -> return ((rate-1)*100)
|
Root rate -> return ((rate-1)*100)
|
||||||
NotBracketed -> error "Error: No solution -- not bracketed."
|
NotBracketed -> error "Error: No solution -- not bracketed."
|
||||||
SearchFailed -> error "Error: Failed to find solution."
|
SearchFailed -> error "Error: Failed to find solution."
|
||||||
|
|||||||
@ -4,7 +4,7 @@ cabal-version: 1.12
|
|||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: 459ec44c2ae4fd1a0f7e0f8001c3efae2a39ff8b1ef53baa0a510b0674e98c2c
|
-- hash: 38ae7b05855ed1a89093bf46334c3ccd5d3e992499741befae04883a34da86b0
|
||||||
|
|
||||||
name: hledger
|
name: hledger
|
||||||
version: 1.12
|
version: 1.12
|
||||||
@ -132,6 +132,7 @@ library
|
|||||||
, here
|
, here
|
||||||
, hledger-lib >=1.12 && <1.13
|
, hledger-lib >=1.12 && <1.13
|
||||||
, lucid
|
, lucid
|
||||||
|
, math-functions >=0.2.0.0
|
||||||
, megaparsec >=7.0.0 && <8
|
, megaparsec >=7.0.0 && <8
|
||||||
, mtl
|
, mtl
|
||||||
, mtl-compat
|
, mtl-compat
|
||||||
@ -143,7 +144,6 @@ library
|
|||||||
, safe >=0.2
|
, safe >=0.2
|
||||||
, shakespeare >=2.0.2.2
|
, shakespeare >=2.0.2.2
|
||||||
, split >=0.1
|
, split >=0.1
|
||||||
, statistics <=0.15
|
|
||||||
, tabular >=0.2
|
, tabular >=0.2
|
||||||
, temporary
|
, temporary
|
||||||
, text >=0.11
|
, text >=0.11
|
||||||
@ -183,6 +183,7 @@ executable hledger
|
|||||||
, here
|
, here
|
||||||
, hledger
|
, hledger
|
||||||
, hledger-lib >=1.12 && <1.13
|
, hledger-lib >=1.12 && <1.13
|
||||||
|
, math-functions >=0.2.0.0
|
||||||
, megaparsec >=7.0.0 && <8
|
, megaparsec >=7.0.0 && <8
|
||||||
, mtl
|
, mtl
|
||||||
, mtl-compat
|
, mtl-compat
|
||||||
@ -194,7 +195,6 @@ executable hledger
|
|||||||
, safe >=0.2
|
, safe >=0.2
|
||||||
, shakespeare >=2.0.2.2
|
, shakespeare >=2.0.2.2
|
||||||
, split >=0.1
|
, split >=0.1
|
||||||
, statistics <=0.15
|
|
||||||
, tabular >=0.2
|
, tabular >=0.2
|
||||||
, temporary
|
, temporary
|
||||||
, text >=0.11
|
, text >=0.11
|
||||||
@ -237,6 +237,7 @@ test-suite test
|
|||||||
, here
|
, here
|
||||||
, hledger
|
, hledger
|
||||||
, hledger-lib >=1.12 && <1.13
|
, hledger-lib >=1.12 && <1.13
|
||||||
|
, math-functions >=0.2.0.0
|
||||||
, megaparsec >=7.0.0 && <8
|
, megaparsec >=7.0.0 && <8
|
||||||
, mtl
|
, mtl
|
||||||
, mtl-compat
|
, mtl-compat
|
||||||
@ -248,7 +249,6 @@ test-suite test
|
|||||||
, safe >=0.2
|
, safe >=0.2
|
||||||
, shakespeare >=2.0.2.2
|
, shakespeare >=2.0.2.2
|
||||||
, split >=0.1
|
, split >=0.1
|
||||||
, statistics <=0.15
|
|
||||||
, tabular >=0.2
|
, tabular >=0.2
|
||||||
, temporary
|
, temporary
|
||||||
, test-framework
|
, test-framework
|
||||||
@ -292,6 +292,7 @@ benchmark bench
|
|||||||
, hledger
|
, hledger
|
||||||
, hledger-lib >=1.12 && <1.13
|
, hledger-lib >=1.12 && <1.13
|
||||||
, html
|
, html
|
||||||
|
, math-functions >=0.2.0.0
|
||||||
, megaparsec >=7.0.0 && <8
|
, megaparsec >=7.0.0 && <8
|
||||||
, mtl
|
, mtl
|
||||||
, mtl-compat
|
, mtl-compat
|
||||||
@ -303,7 +304,6 @@ benchmark bench
|
|||||||
, safe >=0.2
|
, safe >=0.2
|
||||||
, shakespeare >=2.0.2.2
|
, shakespeare >=2.0.2.2
|
||||||
, split >=0.1
|
, split >=0.1
|
||||||
, statistics <=0.15
|
|
||||||
, tabular >=0.2
|
, tabular >=0.2
|
||||||
, temporary
|
, temporary
|
||||||
, text >=0.11
|
, text >=0.11
|
||||||
|
|||||||
@ -104,7 +104,7 @@ dependencies:
|
|||||||
- safe >=0.2
|
- safe >=0.2
|
||||||
- shakespeare >=2.0.2.2
|
- shakespeare >=2.0.2.2
|
||||||
- split >=0.1
|
- split >=0.1
|
||||||
- statistics <=0.15
|
- math-functions >=0.2.0.0
|
||||||
- tabular >=0.2
|
- tabular >=0.2
|
||||||
- temporary
|
- temporary
|
||||||
- text >=0.11
|
- text >=0.11
|
||||||
|
|||||||
@ -45,6 +45,7 @@ extra-deps:
|
|||||||
- integer-logarithms-1.0.2.1
|
- integer-logarithms-1.0.2.1
|
||||||
- kan-extensions-5.1
|
- kan-extensions-5.1
|
||||||
- lens-4.16.1
|
- lens-4.16.1
|
||||||
|
- math-functions-0.2.1.0
|
||||||
- megaparsec-7.0.1
|
- megaparsec-7.0.1
|
||||||
- microstache-1.0.1.1
|
- microstache-1.0.1.1
|
||||||
- mmorph-1.1.2
|
- mmorph-1.1.2
|
||||||
|
|||||||
@ -24,7 +24,6 @@ extra-deps:
|
|||||||
|
|
||||||
# hledger
|
# hledger
|
||||||
- control-monad-free-0.6.2
|
- control-monad-free-0.6.2
|
||||||
- statistics-0.14.0.2
|
|
||||||
- timeit-2.0
|
- timeit-2.0
|
||||||
- wizards-1.0.3
|
- wizards-1.0.3
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user