diff options
author | Naïm Favier <n@monade.li> | 2022-07-02 18:42:26 +0200 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2022-07-02 19:29:05 +0200 |
commit | c996ce44157e11713b4b6fd588f09becc2252ab0 (patch) | |
tree | b69b1ef6cb2c3fd171d70fe564c6a9165b04544d /pkgs/development/haskell-modules/patches | |
parent | 3865a901725e316fe0a98d1df025527ef7348f8f (diff) |
haskellPackages.misfortune: remove patch
Applied in 0.1.2: https://github.com/ncfavier/misfortune/commit/59fe811f30b3544b71d19276076021bba82d2498
Diffstat (limited to 'pkgs/development/haskell-modules/patches')
-rw-r--r-- | pkgs/development/haskell-modules/patches/misfortune-ghc9.patch | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/pkgs/development/haskell-modules/patches/misfortune-ghc9.patch b/pkgs/development/haskell-modules/patches/misfortune-ghc9.patch deleted file mode 100644 index 39f983b15d78e..0000000000000 --- a/pkgs/development/haskell-modules/patches/misfortune-ghc9.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/misfortune.cabal b/misfortune.cabal -index f5d0dd3..faa5794 100644 ---- a/misfortune.cabal -+++ b/misfortune.cabal -@@ -113,7 +113,8 @@ Library - directory, - filepath, - knob, -- random-fu >= 0.2.2, -+ random, -+ random-fu >= 0.3, - semigroups, - text, - utf8-string, -diff --git a/src/Data/Fortune.hs b/src/Data/Fortune.hs -index 16d221e..ffbc970 100644 ---- a/src/Data/Fortune.hs -+++ b/src/Data/Fortune.hs -@@ -64,6 +64,7 @@ import Paths_misfortune - import System.Directory - import System.Environment - import System.FilePath -+import System.Random.Stateful (newIOGenM, newStdGen) - - -- |The number of fortune strings in the index - numFortunes :: S.FortuneStats -> Int -@@ -233,9 +234,10 @@ randomFortune paths = withFortuneFiles '%' False paths $ \fs -> do - -- random fortune from that file (unformly). - randomFortuneFromRandomFile :: RVar FortuneFile -> IO String - randomFortuneFromRandomFile file = do -- f <- sample file -+ gen <- newStdGen >>= newIOGenM -+ f <- sampleFrom gen file - n <- getNumFortunes f -- i <- sample (uniform 0 (n-1)) -+ i <- sampleFrom gen (uniform 0 (n-1)) - T.unpack <$> getFortune f i - - -- |Given a list of 'FortuneFile's, compute a distrubution over them weighted by the number -diff --git a/src/Fortune.hs b/src/Fortune.hs -index 5a27578..d6ffb74 100644 ---- a/src/Fortune.hs -+++ b/src/Fortune.hs -@@ -21,6 +21,7 @@ import System.Environment - import System.Exit - import System.FilePath - import System.IO -+import System.Random.Stateful (newIOGenM, newStdGen) - import Text.Printf - import Text.Regex.Base - import Text.Regex.PCRE -@@ -200,6 +201,7 @@ main = do - fortunes <- filterM (filterFile args) (fortuneFiles args) - - dist <- getDist args fortunes -+ gen <- newStdGen >>= newIOGenM - - when (numEvents dist == 0) $ do - hPutStrLn stderr "No fortunes matched the filter criteria" -@@ -225,8 +227,8 @@ main = do - , let pctStr = printf "(%.2f%%)" (100 * weight / totalWeight dist) :: String - ] - else do -- (file, fortuneDist) <- sample dist -- fortune <- sample fortuneDist -+ (file, fortuneDist) <- sampleFrom gen dist -+ fortune <- sampleFrom gen fortuneDist - putStrLn . T.unpack =<< getFortune file fortune - - getDist :: Args -> [FortuneFile] -> IO (Categorical Float (FortuneFile, Categorical Float Int)) |