<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Some time ago I wrote a little test program for random number generation. Under 7.8.3 I get<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Total   time    9.03s  (  9.15s elapsed)</div></blockquote><br class=""></div><div class="">Under 7.10.3 I get</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Total   time   24.773s  ( 25.288s elapsed)</div></blockquote><br class=""></div><div class="">Now of course it could be the libraries that I am using rather than GHC itself so I have tried to make them as similar as possible. For 7.8.3 I have</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  build-depends:      base ==4.7.0.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mtl ==2.1.3.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      primitive == 0.6,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mwc-random == 0.13.3.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      vector == 0.10.12.3,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random ==1.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-fu == 0.2.6.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-source == 0.3.0.6</div></blockquote><br class=""></div><div class="">For 7.10.3 I have</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  build-depends:      base ==4.8.2.0,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mtl ==2.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      primitive == 0.6,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mwc-random == 0.13.3.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      vector == 0.10.12.3,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random ==1.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-fu == 0.2.6.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-source == 0.3.0.6</div></blockquote><br class=""></div><div class="">So the only differences are in mtl and base. I don’t seem to be able to coax cabal into using mtl-2.2 for 7.8.3 with all the other required libraries.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">dominic@ghcPerformance:~$ cabal install 'random-source ==0.3.0.6' 'random-fu ==0.2.6.2' 'random ==1.1' 'primitive ==0.6' 'mwc-random ==0.13.3.2' 'mtl ==2.2' 'vector ==0.10.12.3' --with-ghc=ghc-7.10.3</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Resolving dependencies...</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">All the requested packages are already installed:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">mtl-2.2</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">mwc-random-0.13.3.2</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">primitive-0.6</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">random-1.1</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">random-fu-0.2.6.2</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">random-source-0.3.0.6</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">vector-0.10.12.3</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Use --reinstall if you want to reinstall anyway.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">dominic@ghcPerformance:~$ cabal install 'random-source ==0.3.0.6' 'random-fu ==0.2.6.2' 'random ==1.1' 'primitive ==0.6' 'mwc-random ==0.13.3.2' 'mtl ==2.2' 'vector ==0.10.12.3' --with-ghc=ghc-7.8.3</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Resolving dependencies...</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">cabal: Could not resolve dependencies:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">trying: random-source-0.3.0.6/installed-70e... (user goal)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">next goal: mtl (user goal)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">rejecting: mtl-2.2.1, 2.2.0.1 (global constraint requires ==2.2)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">rejecting: mtl-2.2/installed-cc5..., 2.2 (conflict: random-source =></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">mtl==2.1.3.1/installed-8bc...)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">rejecting: mtl-2.1.3.1/installed-8bc..., 2.1.3.1, 2.1.2, 2.1.1, 2.1, 2.0.1.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">2.0.1.0, 2.0.0.0, 1.1.1.1, 1.1.1.0, 1.1.0.2, 1.1.0.1, 1.1.0.0, 1.0 (global</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">constraint requires ==2.2)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Backjump limit reached (change with --max-backjumps).</div></blockquote><br class=""></div><div class="">Cabal seems to be telling me that random-source-0.3.0.6 is the problem but if I look at the constraints for that package here <a href="https://hackage.haskell.org/package/random-source" class="">https://hackage.haskell.org/package/random-source</a> then I see</div><div class=""><br class=""></div><blockquote type="cite" class=""><span style="font-family: sans-serif; font-size: 14.6667px; line-height: 20.5333px; widows: 1; background-color: rgb(255, 255, 255);" class=""> </span><a href="https://hackage.haskell.org/package/mtl" style="margin: 0px; padding: 0px; text-decoration: none; color: rgb(171, 105, 84); font-family: sans-serif; font-size: 14.6667px; line-height: 20.5333px; widows: 1; background-color: rgb(255, 255, 255);" class="">mtl</a><span style="font-family: sans-serif; font-size: 14.6667px; line-height: 20.5333px; widows: 1; background-color: rgb(255, 255, 255);" class=""> (>=1 && <3)</span></blockquote><div class=""><br class=""></div>I am not sure how to proceed from here. Should I raise an issue on the GHC bug tracker? I’d like to solve this myself but I don’t want to start building versions of ghc to see which change caused the regression without first eliminating mtl.<div class=""><br class=""></div><div class="">Any ideas would be gratefully received.</div><div class=""><div class=""><div class=""><br class=""><div class="">
<div class="">Dominic Steinitz</div><div class=""><a href="mailto:dominic@steinitz.org" class="">dominic@steinitz.org</a></div><div class=""><a href="http://idontgetoutmuch.wordpress.com" class="">http://idontgetoutmuch.wordpress.com</a></div>

</div><div class=""><br class="webkit-block-placeholder"></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">{-# LANGUAGE TemplateHaskell   #-}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">{-# LANGUAGE GADTs             #-}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">{-# LANGUAGE FlexibleInstances #-}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">import Data.Random</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">import Data.Random.Source</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">import qualified System.Random.MWC as MWC</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">import Control.Monad.Reader</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">import Control.Monad.Primitive</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">$(monadRandom [d|</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  instance (PrimMonad m, s ~ PrimState m) => MonadRandom (ReaderT (MWC.Gen s) m) where</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    getRandomWord16 = ask >>= lift . MWC.uniform</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    getRandomWord32 = ask >>= lift . MWC.uniform</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    getRandomWord64 = ask >>= lift . MWC.uniform</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  |])</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">testUniform :: MonadRandom m => Int -> m [Double]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">testUniform n = replicateM (fromIntegral n) (sample stdUniform)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">n :: Int</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">n = 10^7</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">main :: IO ()</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">main = do</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    seed <- MWC.create</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    xs <- runReaderT (testUniform n) seed</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">    print (sum xs / fromIntegral n)</div></blockquote><br class=""></div><div class="">This cabal file will build this on 7.8.3</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">name:                PerfTest8</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">version:             0.1.0.0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">homepage:            TBD</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">license:             MIT</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">author:              Dominic Steinitz</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">maintainer:          <a href="mailto:idontgetoutmuch@gmail.com" class="">idontgetoutmuch@gmail.com</a></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">category:            System</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">build-type:          Simple</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">cabal-version:       >=1.10</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">executable Random8</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  main-is:            TestMwcViaRandomSource.hs</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  build-depends:      base ==4.7.0.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mtl ==2.1.3.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      primitive == 0.6,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mwc-random == 0.13.3.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      vector == 0.10.12.3,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random ==1.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-fu == 0.2.6.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-source == 0.3.0.6</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  default-language:   Haskell2010</div></blockquote><br class=""></div><div class="">This cabal file will build this on 7.10.3</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">name:                PerfTest10</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">version:             0.1.0.0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">homepage:            TBD</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">license:             MIT</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">author:              Dominic Steinitz</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">maintainer:          <a href="mailto:idontgetoutmuch@gmail.com" class="">idontgetoutmuch@gmail.com</a></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">category:            System</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">build-type:          Simple</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">cabal-version:       >=1.10</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">executable Random10</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  main-is:            TestMwcViaRandomSource.hs</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  build-depends:      base ==4.8.2.0,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mtl ==2.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      primitive == 0.6,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      mwc-random == 0.13.3.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      vector == 0.10.12.3,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random ==1.1,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-fu == 0.2.6.2,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                      random-source == 0.3.0.6</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  default-language:   Haskell2010</div></blockquote></div>
<br class=""></div></div></div></body></html>