aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-11-27 15:31:17 -0500
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:40 +0100
commit97be338188b19abbe9931a4e4b765d9fd14583a4 (patch)
tree3094b4d7f4a905223eea26139b14bb3a80ff2707
parent2fc47ceebf5ec4e93e7a4395939c2da5248e1ef6 (diff)
downloadpandoc-97be338188b19abbe9931a4e4b765d9fd14583a4.tar.gz
Change Test{State,Env} to Pure{State,Env}
This was left over from when the pure function was called runTest.
-rw-r--r--src/Text/Pandoc/Class.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs
index 7de927bcc..ab1cc32b8 100644
--- a/src/Text/Pandoc/Class.hs
+++ b/src/Text/Pandoc/Class.hs
@@ -32,8 +32,8 @@ Typeclass for pandoc readers and writers, allowing both IO and pure instances.
-}
module Text.Pandoc.Class ( PandocMonad(..)
- , TestState(..)
- , TestEnv(..)
+ , PureState(..)
+ , PureEnv(..)
, getPOSIXTime
, PandocIO(..)
, PandocPure(..)
@@ -170,7 +170,7 @@ instance PandocMonad PandocIO where
insertMedia fp mime bs =
modify $ \st -> st{ioStMediaBag = MB.insertMedia fp mime bs (ioStMediaBag st) }
-data TestState = TestState { stStdGen :: StdGen
+data PureState = PureState { stStdGen :: StdGen
, stWord8Store :: [Word8] -- should be
-- inifinite,
-- i.e. [1..]
@@ -183,15 +183,15 @@ data TestState = TestState { stStdGen :: StdGen
, stMediaBag :: MediaBag
}
-instance Default TestState where
- def = TestState { stStdGen = mkStdGen 1848
+instance Default PureState where
+ def = PureState { stStdGen = mkStdGen 1848
, stWord8Store = [1..]
, stWarnings = []
, stUniqStore = [1..]
, stMediaBag = mempty
}
-data TestEnv = TestEnv { envEnv :: [(String, String)]
+data PureEnv = PureEnv { envEnv :: [(String, String)]
, envTime :: UTCTime
, envReferenceDocx :: Archive
, envReferenceODT :: Archive
@@ -203,8 +203,8 @@ data TestEnv = TestEnv { envEnv :: [(String, String)]
-- We have to figure this out a bit more. But let's put some empty
-- values in for the time being.
-instance Default TestEnv where
- def = TestEnv { envEnv = [("USER", "pandoc-user")]
+instance Default PureEnv where
+ def = PureEnv { envEnv = [("USER", "pandoc-user")]
, envTime = posixSecondsToUTCTime 0
, envReferenceDocx = emptyArchive
, envReferenceODT = emptyArchive
@@ -218,8 +218,8 @@ instance E.Exception PandocExecutionError
newtype PandocPure a = PandocPure {
unPandocPure :: ExceptT PandocExecutionError
- (ReaderT TestEnv (State TestState)) a
- } deriving (Functor, Applicative, Monad, MonadReader TestEnv, MonadState TestState, MonadError PandocExecutionError)
+ (ReaderT PureEnv (State PureState)) a
+ } deriving (Functor, Applicative, Monad, MonadReader PureEnv, MonadState PureState, MonadError PandocExecutionError)
runPure :: PandocPure a -> Either PandocExecutionError a
runPure x = flip evalState def $ flip runReaderT def $ runExceptT $ unPandocPure x