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 monad to handle
actions with a PandocMonad contraint via
polysemy effects and IO.
Has an "absorber" to convert functions with a PandocMonad
constraint.
Synopsis
- data Pandoc m r
- type PandocEffects effs = (Member Pandoc effs, Member Template effs, Member (Error PandocError) effs, Member PrefixLog effs, Member (Logger LogEntry) effs)
- type PandocEffectsIO effs = (PandocEffects effs, Member (Embed IO) effs)
- lookupEnv :: forall r. MemberWithError Pandoc r => PandocText -> Sem r (Maybe PandocText)
- getCurrentTime :: forall r. MemberWithError Pandoc r => Sem r UTCTime
- getCurrentTimeZone :: forall r. MemberWithError Pandoc r => Sem r TimeZone
- newStdGen :: forall r. MemberWithError Pandoc r => Sem r StdGen
- newUniqueHash :: forall r. MemberWithError Pandoc r => Sem r Int
- openURL :: forall r. MemberWithError Pandoc r => PandocText -> Sem r (ByteString, Maybe MimeType)
- readFileLazy :: forall r. MemberWithError Pandoc r => FilePath -> Sem r ByteString
- readFileStrict :: forall r. MemberWithError Pandoc r => FilePath -> Sem r ByteString
- glob :: forall r. MemberWithError Pandoc r => String -> Sem r [FilePath]
- fileExists :: forall r. MemberWithError Pandoc r => FilePath -> Sem r Bool
- getDataFileName :: forall r. MemberWithError Pandoc r => FilePath -> Sem r FilePath
- getModificationTime :: forall r. MemberWithError Pandoc r => FilePath -> Sem r UTCTime
- getCommonState :: forall r. MemberWithError Pandoc r => Sem r CommonState
- putCommonState :: forall r. MemberWithError Pandoc r => CommonState -> Sem r ()
- getsCommonState :: forall r a. MemberWithError Pandoc r => (CommonState -> a) -> Sem r a
- modifyCommonState :: forall r. MemberWithError Pandoc r => (CommonState -> CommonState) -> Sem r ()
- logOutput :: forall r. MemberWithError Pandoc r => LogMessage -> Sem r ()
- trace :: forall r. MemberWithError Pandoc r => PandocText -> Sem r ()
- textToPandocText :: Text -> PandocText
- pandocTextToText :: PandocText -> Text
- absorbTemplateMonad :: Member Template r => (TemplateMonad (Sem r) => Sem r a) -> Sem r a
- data Template m a
- interpretTemplateIO :: forall effs a. Member (Embed IO) effs => Sem (Template ': effs) a -> Sem effs a
- interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Embed m) effs, Member (Logger LogEntry) effs) => Sem (Pandoc ': effs) a -> Sem effs a
- interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Embed IO) effs, Member (Error PandocError) effs) => Sem (Pandoc ': effs) a -> Sem effs a
- absorbPandocMonad :: Members '[Error PandocError, Pandoc] r => (PandocMonad (Sem r) => Sem r a) -> Sem r a
- data PandocError
Types
type PandocEffects effs = (Member Pandoc effs, Member Template 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 (Embed IO) effs) Source #
Constraint helper for using this set of effects in IO.
Actions
getCurrentTime :: forall r. MemberWithError Pandoc r => Sem r UTCTime Source #
getCurrentTimeZone :: forall r. MemberWithError Pandoc r => Sem r TimeZone Source #
newUniqueHash :: forall r. MemberWithError Pandoc r => Sem r Int Source #
openURL :: forall r. MemberWithError Pandoc r => PandocText -> Sem r (ByteString, Maybe MimeType) Source #
readFileLazy :: forall r. MemberWithError Pandoc r => FilePath -> Sem r ByteString Source #
readFileStrict :: forall r. MemberWithError Pandoc r => FilePath -> Sem r ByteString Source #
fileExists :: forall r. MemberWithError Pandoc r => FilePath -> Sem r Bool Source #
getDataFileName :: forall r. MemberWithError Pandoc r => FilePath -> Sem r FilePath Source #
getModificationTime :: forall r. MemberWithError Pandoc r => FilePath -> Sem r UTCTime Source #
getCommonState :: forall r. MemberWithError Pandoc r => Sem r CommonState Source #
putCommonState :: forall r. MemberWithError Pandoc r => CommonState -> Sem r () Source #
getsCommonState :: forall r a. MemberWithError Pandoc r => (CommonState -> a) -> Sem r a Source #
modifyCommonState :: forall r. MemberWithError Pandoc r => (CommonState -> CommonState) -> Sem r () Source #
logOutput :: forall r. MemberWithError Pandoc r => LogMessage -> Sem r () Source #
Pandoc <2.8 compatibility
textToPandocText :: Text -> PandocText Source #
pandocTextToText :: PandocText -> Text Source #
absorbTemplateMonad :: Member Template r => (TemplateMonad (Sem r) => Sem r a) -> Sem r a Source #
use a Polysemy stack containing the Template
effect to run an TemplateMonad m action.
interpretTemplateIO :: forall effs a. Member (Embed IO) effs => Sem (Template ': effs) a -> Sem effs a Source #
Interpret a Template effect in any stack with IO (via the IO instance in DocTemplates)
Interpreters
interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Embed 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 (Embed 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
Interop
absorbPandocMonad :: Members '[Error PandocError, Pandoc] r => (PandocMonad (Sem r) => Sem r a) -> Sem r a Source #
absorb a PandocMonad
constraint into
Members [Pandoc, Error PandocError] r => Sem r
Re-Exports
data PandocError #