Skip to content

Commit

Permalink
fix BDD.uniformSatM to work with mwc-random <0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Nov 22, 2021
1 parent f3d241b commit ba00306
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Data/DecisionDiagram/BDD.hs
Expand Up @@ -140,11 +140,11 @@ import Data.STRef
import qualified Data.Vector as V
import GHC.Generics (Generic)
import Numeric.Natural
import System.Random.MWC (uniformM)
#if MIN_VERSION_mwc_random(0,15,0)
import System.Random.MWC (Uniform (..))
import System.Random.Stateful (StatefulGen (..))
#else
import System.Random.MWC (Gen)
import System.Random.MWC (Gen, Variate (..))
#endif
import System.Random.MWC.Distributions (bernoulli)
import Text.Read
Expand Down Expand Up @@ -1015,7 +1015,11 @@ uniformSatM xs0 bdd0 = func IntMap.empty
(Leaf _, _:_) -> error ("uniformSatM: should not happen")
(s, func0) <- g xs' bdd
let func' !m !gen = do
#if MIN_VERSION_mwc_random(0,15,0)
vals <- replicateM (length ys) (uniformM gen)
#else
vals <- replicateM (length ys) (uniform gen)
#endif
func0 (m `IntMap.union` IntMap.fromList (zip ys vals)) gen
return (s `shiftL` length ys, func')
g _ (Leaf True) = return (1 :: Integer, \a _gen -> return a)
Expand Down

0 comments on commit ba00306

Please sign in to comment.