diff options
| author | John MacFarlane <[email protected]> | 2025-04-05 12:31:40 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-04-05 12:31:40 -0700 |
| commit | f8f7c29fb81468a7b559e9590089152cee5d0b04 (patch) | |
| tree | e1fe17b93e6f74c99d3c72fbbe1734f70ea120d8 | |
| parent | 0d2114ee4e3974583ee84e8a4e992562d6502f66 (diff) | |
Allow compilation with random 1.2.*.
| -rw-r--r-- | pandoc.cabal | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Class/PandocPure.hs | 14 | ||||
| -rw-r--r-- | stack.yaml | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index afed82270..b064658d0 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -526,7 +526,7 @@ library pretty >= 1.1 && < 1.2, pretty-show >= 1.10 && < 1.11, process >= 1.2.3 && < 1.7, - random >= 1.3 && < 1.4, + random >= 1.2 && < 1.4, safe >= 0.3.18 && < 0.4, scientific >= 0.3 && < 0.4, skylighting >= 0.14.5 && < 0.15, diff --git a/src/Text/Pandoc/Class/PandocPure.hs b/src/Text/Pandoc/Class/PandocPure.hs index c026d89f5..12923abb5 100644 --- a/src/Text/Pandoc/Class/PandocPure.hs +++ b/src/Text/Pandoc/Class/PandocPure.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} @@ -49,7 +50,7 @@ import Data.Word (Word8) import System.Directory (doesDirectoryExist, getDirectoryContents) import System.FilePath ((</>)) import System.FilePath.Glob (match, compile) -import System.Random (StdGen, splitGen, mkStdGen) +import System.Random (StdGen, mkStdGen) import Text.Pandoc.Class.CommonState (CommonState (..)) import Text.Pandoc.Class.PandocMonad import Text.Pandoc.Error @@ -59,6 +60,15 @@ import qualified Data.Map as M import qualified Data.Text as T import qualified System.Directory as Directory (getModificationTime) +#if MIN_VERSION_random(1,3,0) +import System.Random (splitGen, SplitGen) + +split :: SplitGen g => g -> (g, g) +split = splitGen +#else +import System.Random (split) +#endif + -- | The 'PureState' contains ersatz representations -- of things that would normally be obtained through IO. data PureState = PureState @@ -180,7 +190,7 @@ instance PandocMonad PandocPure where newStdGen = do oldGen <- getsPureState stStdGen - let (genToStore, genToReturn) = splitGen oldGen + let (genToStore, genToReturn) = split oldGen modifyPureState $ \st -> st { stStdGen = genToStore } return genToReturn diff --git a/stack.yaml b/stack.yaml index 19d644c0c..427e6ff39 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,6 @@ extra-deps: - commonmark-pandoc-0.2.3 - typst-0.7 - texmath-0.12.9 -- random-1.3.0 - git: https://github.com/jgm/citeproc.git commit: cf5542df8f21085bbfd794eaa5cc40abc605637b |
