Copyright | (c) Adam Conner-Sax 2019 |
---|---|
License | BSD-3-Clause |
Maintainer | adam_conner_sax@yahoo.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Polysemy PandocMonad effect. Allows a polysemy "stack" to satisfy a PandocMonad constraint. This still needs to run on top of PandocIO but that will likely be addressed at some point in the future, just requiring IO at base and the Logging and Random effects.
Synopsis
- data Pandoc m r
- type PandocEffects effs = (Member Pandoc effs, Member (Error PandocError) effs, Member PrefixLog effs, Member (Logger LogEntry) effs)
- type PandocEffectsIO effs = (PandocEffects effs, Member (Lift IO) effs)
- lookupEnv :: forall r. Member Pandoc r => String -> Semantic r (Maybe String)
- getCurrentTime :: forall r. Member Pandoc r => Semantic r UTCTime
- getCurrentTimeZone :: forall r. Member Pandoc r => Semantic r TimeZone
- newStdGen :: forall r. Member Pandoc r => Semantic r StdGen
- newUniqueHash :: forall r. Member Pandoc r => Semantic r Int
- openURL :: forall r. Member Pandoc r => String -> Semantic r (ByteString, Maybe MimeType)
- readFileLazy :: forall r. Member Pandoc r => FilePath -> Semantic r ByteString
- readFileStrict :: forall r. Member Pandoc r => FilePath -> Semantic r ByteString
- glob :: forall r. Member Pandoc r => String -> Semantic r [FilePath]
- fileExists :: forall r. Member Pandoc r => FilePath -> Semantic r Bool
- getDataFileName :: forall r. Member Pandoc r => FilePath -> Semantic r FilePath
- getModificationTime :: forall r. Member Pandoc r => FilePath -> Semantic r UTCTime
- getCommonState :: forall r. Member Pandoc r => Semantic r CommonState
- putCommonState :: forall r. Member Pandoc r => CommonState -> Semantic r ()
- getsCommonState :: forall a. forall r. Member Pandoc r => (CommonState -> a) -> Semantic r a
- modifyCommonState :: forall r. Member Pandoc r => (CommonState -> CommonState) -> Semantic r ()
- logOutput :: forall r. Member Pandoc r => LogMessage -> Semantic r ()
- trace :: forall r. Member Pandoc r => String -> Semantic r ()
- interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Semantic (Pandoc ': effs) a -> Semantic effs a
- interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Lift IO) effs, Member (Error PandocError) effs) => Semantic (Pandoc ': effs) a -> Semantic effs a
- runIO :: [LogSeverity] -> Semantic '[Pandoc, Logger LogEntry, PrefixLog, Error PandocError, Lift IO] a -> IO (Either PandocError a)
- data PandocError
Types
type PandocEffects effs = (Member Pandoc effs, Member (Error PandocError) effs, Member PrefixLog effs, Member (Logger LogEntry) effs) Source #
Constraint helper for using this set of effects in IO.
type PandocEffectsIO effs = (PandocEffects effs, Member (Lift IO) effs) Source #
Constraint helper for using this set of effects in IO.
Actions
readFileLazy :: forall r. Member Pandoc r => FilePath -> Semantic r ByteString Source #
readFileStrict :: forall r. Member Pandoc r => FilePath -> Semantic r ByteString Source #
getCommonState :: forall r. Member Pandoc r => Semantic r CommonState Source #
putCommonState :: forall r. Member Pandoc r => CommonState -> Semantic r () Source #
getsCommonState :: forall a. forall r. Member Pandoc r => (CommonState -> a) -> Semantic r a Source #
modifyCommonState :: forall r. Member Pandoc r => (CommonState -> CommonState) -> Semantic r () Source #
Interpreters
interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Semantic (Pandoc ': effs) a -> Semantic effs a Source #
Interpret the Pandoc effect in another monad (which must satisy the PandocMonad constraint) and Knit.Effect.Logger
interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Lift IO) effs, Member (Error PandocError) effs) => Semantic (Pandoc ': effs) a -> Semantic effs a Source #
Interpret the Pandoc effect using IO
, Knit.Effect.Logger
and PolySemy.Error PandocError
Runners
runIO :: [LogSeverity] -> Semantic '[Pandoc, Logger LogEntry, PrefixLog, Error PandocError, Lift IO] a -> IO (Either PandocError a) Source #
Run the Pandoc effects, and log messages with the given severity, over IO. If there is a Pandoc error, you will get a Left in the resulting Either.
Re-Exports
data PandocError #