diff --git a/CHANGES b/CHANGES
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,12 @@
 User-visible changes in the hledger command line tool (and hledger-lib).
 
 
+# 1.12.1 (2018/12/03)
+
+* roi: use math-functions lib instead of statistics,
+  be more stackage nightly compatible  
+
+
 # 1.12 (2018/12/02)
 
 * install script: ensure a new-enough version of stack; more informative output
diff --git a/Hledger/Cli/Commands/Roi.hs b/Hledger/Cli/Commands/Roi.hs
--- a/Hledger/Cli/Commands/Roi.hs
+++ b/Hledger/Cli/Commands/Roi.hs
@@ -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.
@@ -17,7 +17,7 @@
 import Data.Function (on)
 import Data.List
 import Data.Ord
-import Statistics.Math.RootFinding
+import Numeric.RootFinding
 import Data.Decimal
 import Data.String.Here
 import System.Console.CmdArgs.Explicit as CmdArgs
@@ -216,7 +216,13 @@
        (map ((:[]) . show) amounts))
                              
   -- 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)
     NotBracketed -> error "Error: No solution -- not bracketed."
     SearchFailed -> error "Error: Failed to find solution."
diff --git a/hledger.cabal b/hledger.cabal
--- a/hledger.cabal
+++ b/hledger.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 459ec44c2ae4fd1a0f7e0f8001c3efae2a39ff8b1ef53baa0a510b0674e98c2c
+-- hash: 269994bfba5ad36962478f05df1bf958a94778ec5b36db499d768b64aa3e411a
 
 name:           hledger
-version:        1.12
+version:        1.12.1
 synopsis:       Command-line interface for the hledger accounting tool
 description:    This is hledger's command-line interface.
                 Its basic function is to read a plain text file describing
@@ -112,7 +112,7 @@
   other-modules:
       Paths_hledger
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path
-  cpp-options: -DVERSION="1.12"
+  cpp-options: -DVERSION="1.12.1"
   build-depends:
       Decimal
     , Diff
@@ -132,6 +132,7 @@
     , here
     , hledger-lib >=1.12 && <1.13
     , lucid
+    , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8
     , mtl
     , mtl-compat
@@ -143,7 +144,6 @@
     , safe >=0.2
     , shakespeare >=2.0.2.2
     , split >=0.1
-    , statistics <=0.15
     , tabular >=0.2
     , temporary
     , text >=0.11
@@ -165,7 +165,7 @@
   hs-source-dirs:
       app
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path
-  cpp-options: -DVERSION="1.12"
+  cpp-options: -DVERSION="1.12.1"
   build-depends:
       Decimal
     , ansi-terminal >=0.6.2.3
@@ -183,6 +183,7 @@
     , here
     , hledger
     , hledger-lib >=1.12 && <1.13
+    , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8
     , mtl
     , mtl-compat
@@ -194,7 +195,6 @@
     , safe >=0.2
     , shakespeare >=2.0.2.2
     , split >=0.1
-    , statistics <=0.15
     , tabular >=0.2
     , temporary
     , text >=0.11
@@ -219,7 +219,7 @@
   hs-source-dirs:
       test
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path
-  cpp-options: -DVERSION="1.12"
+  cpp-options: -DVERSION="1.12.1"
   build-depends:
       Decimal
     , ansi-terminal >=0.6.2.3
@@ -237,6 +237,7 @@
     , here
     , hledger
     , hledger-lib >=1.12 && <1.13
+    , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8
     , mtl
     , mtl-compat
@@ -248,7 +249,6 @@
     , safe >=0.2
     , shakespeare >=2.0.2.2
     , split >=0.1
-    , statistics <=0.15
     , tabular >=0.2
     , temporary
     , test-framework
@@ -292,6 +292,7 @@
     , hledger
     , hledger-lib >=1.12 && <1.13
     , html
+    , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8
     , mtl
     , mtl-compat
@@ -303,7 +304,6 @@
     , safe >=0.2
     , shakespeare >=2.0.2.2
     , split >=0.1
-    , statistics <=0.15
     , tabular >=0.2
     , temporary
     , text >=0.11
