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 -> Sem r (Maybe String)
- getCurrentTime :: forall r. Member Pandoc r => Sem r UTCTime
- getCurrentTimeZone :: forall r. Member Pandoc r => Sem r TimeZone
- newStdGen :: forall r. Member Pandoc r => Sem r StdGen
- newUniqueHash :: forall r. Member Pandoc r => Sem r Int
- openURL :: forall r. Member Pandoc r => String -> Sem r (ByteString, Maybe MimeType)
- readFileLazy :: forall r. Member Pandoc r => FilePath -> Sem r ByteString
- readFileStrict :: forall r. Member Pandoc r => FilePath -> Sem r ByteString
- glob :: forall r. Member Pandoc r => String -> Sem r [FilePath]
- fileExists :: forall r. Member Pandoc r => FilePath -> Sem r Bool
- getDataFileName :: forall r. Member Pandoc r => FilePath -> Sem r FilePath
- getModificationTime :: forall r. Member Pandoc r => FilePath -> Sem r UTCTime
- getCommonState :: forall r. Member Pandoc r => Sem r CommonState
- putCommonState :: forall r. Member Pandoc r => CommonState -> Sem r ()
- getsCommonState :: forall a. forall r. Member Pandoc r => (CommonState -> a) -> Sem r a
- modifyCommonState :: forall r. Member Pandoc r => (CommonState -> CommonState) -> Sem r ()
- logOutput :: forall r. Member Pandoc r => LogMessage -> Sem r ()
- trace :: forall r. Member Pandoc r => String -> Sem r ()
- interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Sem (Pandoc ': effs) a -> Sem effs a
- interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Lift IO) effs, Member (Error PandocError) effs) => Sem (Pandoc ': effs) a -> Sem effs a
- runIO :: [LogSeverity] -> Sem '[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 -> Sem r ByteString Source #
readFileStrict :: forall r. Member Pandoc r => FilePath -> Sem r ByteString Source #
getCommonState :: forall r. Member Pandoc r => Sem r CommonState Source #
putCommonState :: forall r. Member Pandoc r => CommonState -> Sem r () Source #
getsCommonState :: forall a. forall r. Member Pandoc r => (CommonState -> a) -> Sem r a Source #
modifyCommonState :: forall r. Member Pandoc r => (CommonState -> CommonState) -> Sem r () Source #
Interpreters
interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Sem (Pandoc ': effs) a -> Sem 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) => Sem (Pandoc ': effs) a -> Sem effs a Source #
Interpret the Pandoc effect using IO
, Knit.Effect.Logger
and PolySemy.Error PandocError
Runners
runIO :: [LogSeverity] -> Sem '[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 #