knit-haskell 0.1.0.0 → 0.2.0.0
raw patch · 21 files changed
+253/−246 lines, 21 filesdep ~basedep ~blaze-htmldep ~containersnew-component:exe:MultiDocExamplePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, blaze-html, containers, here, hvega, polysemy, text, time
API changes (from Hackage documentation)
- Knit.Effect.Logger: data Semantic (r :: [Type -> Type -> Type -> Type]) a
- Knit.Effect.PandocMonad: instance Knit.Effect.PandocMonad.PandocEffects effs => Text.Pandoc.Class.PandocMonad (Polysemy.Internal.Semantic effs)
- Knit.Effect.PandocMonad: instance Polysemy.Internal.Union.Member (Polysemy.Error.Error Text.Pandoc.Error.PandocError) effs => Control.Monad.Error.Class.MonadError Text.Pandoc.Error.PandocError (Polysemy.Internal.Semantic effs)
- Knit.Effect.RandomFu: instance Polysemy.Internal.Union.Member Knit.Effect.RandomFu.Random effs => Data.Random.Internal.Source.MonadRandom (Polysemy.Internal.Semantic effs)
- Knit.Report: data Semantic (r :: [Type -> Type -> Type -> Type]) a
+ Knit.Effect.Logger: data Sem (r :: [Type -> Type -> Type -> Type]) a
+ Knit.Effect.PandocMonad: instance Knit.Effect.PandocMonad.PandocEffects effs => Text.Pandoc.Class.PandocMonad (Polysemy.Internal.Sem effs)
+ Knit.Effect.PandocMonad: instance Polysemy.Internal.Union.Member (Polysemy.Error.Error Text.Pandoc.Error.PandocError) effs => Control.Monad.Error.Class.MonadError Text.Pandoc.Error.PandocError (Polysemy.Internal.Sem effs)
+ Knit.Effect.RandomFu: instance Polysemy.Internal.Union.Member Knit.Effect.RandomFu.Random effs => Data.Random.Internal.Source.MonadRandom (Polysemy.Internal.Sem effs)
+ Knit.Report: NamedDoc :: Text -> a -> NamedDoc a
+ Knit.Report: [ndDoc] :: NamedDoc a -> a
+ Knit.Report: [ndName] :: NamedDoc a -> Text
+ Knit.Report: data NamedDoc a
+ Knit.Report: data Sem (r :: [Type -> Type -> Type -> Type]) a
+ Knit.Report: newPandoc :: (PandocEffects effs, Member Pandocs effs) => Text -> Sem (ToPandoc : effs) () -> Sem effs ()
- Knit.Effect.Docs: newDoc :: Member (Docs a) effs => Text -> a -> Semantic effs ()
+ Knit.Effect.Docs: newDoc :: Member (Docs a) effs => Text -> a -> Sem effs ()
- Knit.Effect.Docs: toNamedDocList :: Typeable a => Semantic (Docs a : effs) () -> Semantic effs [NamedDoc a]
+ Knit.Effect.Docs: toNamedDocList :: Sem (Docs a : effs) () -> Sem effs [NamedDoc a]
- Knit.Effect.Docs: toNamedDocListWith :: Typeable a => (a -> b) -> Semantic (Docs a : effs) () -> Semantic effs [NamedDoc b]
+ Knit.Effect.Docs: toNamedDocListWith :: (a -> b) -> Sem (Docs a : effs) () -> Sem effs [NamedDoc b]
- Knit.Effect.Docs: toNamedDocListWithM :: Typeable a => (a -> Semantic effs b) -> Semantic (Docs a : effs) () -> Semantic effs [NamedDoc b]
+ Knit.Effect.Docs: toNamedDocListWithM :: (a -> Sem effs b) -> Sem (Docs a : effs) () -> Sem effs [NamedDoc b]
- Knit.Effect.Html: blaze :: Member Blaze effs => Html -> Semantic effs ()
+ Knit.Effect.Html: blaze :: Member Blaze effs => Html -> Sem effs ()
- Knit.Effect.Html: blazeHtml :: Semantic (Blaze : effs) () -> Semantic effs Html
+ Knit.Effect.Html: blazeHtml :: Sem (Blaze : effs) () -> Sem effs Html
- Knit.Effect.Html: blazeToNamedText :: Semantic (BlazeDocs : effs) () -> Semantic effs [NamedDoc Text]
+ Knit.Effect.Html: blazeToNamedText :: Sem (BlazeDocs : effs) () -> Sem effs [NamedDoc Text]
- Knit.Effect.Html: blazeToText :: Semantic (Blaze : effs) () -> Semantic effs Text
+ Knit.Effect.Html: blazeToText :: Sem (Blaze : effs) () -> Sem effs Text
- Knit.Effect.Html: lucid :: Member Lucid effs => Html () -> Semantic effs ()
+ Knit.Effect.Html: lucid :: Member Lucid effs => Html () -> Sem effs ()
- Knit.Effect.Html: lucidHtml :: Semantic (Lucid : effs) () -> Semantic effs (Html ())
+ Knit.Effect.Html: lucidHtml :: Sem (Lucid : effs) () -> Sem effs (Html ())
- Knit.Effect.Html: lucidToNamedText :: Semantic (LucidDocs : effs) () -> Semantic effs [NamedDoc Text]
+ Knit.Effect.Html: lucidToNamedText :: Sem (LucidDocs : effs) () -> Sem effs [NamedDoc Text]
- Knit.Effect.Html: lucidToText :: Semantic (Lucid : effs) () -> Semantic effs Text
+ Knit.Effect.Html: lucidToText :: Sem (Lucid : effs) () -> Sem effs Text
- Knit.Effect.Html: newBlazeDoc :: Member BlazeDocs effs => Text -> Semantic (Blaze : effs) () -> Semantic effs ()
+ Knit.Effect.Html: newBlazeDoc :: Member BlazeDocs effs => Text -> Sem (Blaze : effs) () -> Sem effs ()
- Knit.Effect.Html: newLucidDoc :: Member LucidDocs effs => Text -> Semantic (Lucid : effs) () -> Semantic effs ()
+ Knit.Effect.Html: newLucidDoc :: Member LucidDocs effs => Text -> Sem (Lucid : effs) () -> Sem effs ()
- Knit.Effect.Logger: filteredLogEntriesToIO :: MonadIO (Semantic effs) => [LogSeverity] -> Semantic (Logger LogEntry : (PrefixLog : effs)) x -> Semantic effs x
+ Knit.Effect.Logger: filteredLogEntriesToIO :: MonadIO (Sem effs) => [LogSeverity] -> Sem (Logger LogEntry : (PrefixLog : effs)) x -> Sem effs x
- Knit.Effect.Logger: log :: Member (Logger a) effs => a -> Semantic effs ()
+ Knit.Effect.Logger: log :: Member (Logger a) effs => a -> Sem effs ()
- Knit.Effect.Logger: logLE :: Member (Logger LogEntry) effs => LogSeverity -> Text -> Semantic effs ()
+ Knit.Effect.Logger: logLE :: Member (Logger LogEntry) effs => LogSeverity -> Text -> Sem effs ()
- Knit.Effect.Logger: wrapPrefix :: Member PrefixLog effs => Text -> Semantic effs a -> Semantic effs a
+ Knit.Effect.Logger: wrapPrefix :: Member PrefixLog effs => Text -> Sem effs a -> Sem effs a
- Knit.Effect.Pandoc: addFrom :: Member ToPandoc effs => PandocReadFormat a -> ReaderOptions -> a -> Semantic effs ()
+ Knit.Effect.Pandoc: addFrom :: Member ToPandoc effs => PandocReadFormat a -> ReaderOptions -> a -> Sem effs ()
- Knit.Effect.Pandoc: fromPandocE :: PandocEffects effs => PandocWriteFormat a -> WriterOptions -> Semantic (ToPandoc : effs) () -> Semantic effs a
+ Knit.Effect.Pandoc: fromPandocE :: PandocEffects effs => PandocWriteFormat a -> WriterOptions -> Sem (ToPandoc : effs) () -> Sem effs a
- Knit.Effect.Pandoc: newPandoc :: (PandocEffects effs, Member Pandocs effs) => Text -> Semantic (ToPandoc : effs) () -> Semantic effs ()
+ Knit.Effect.Pandoc: newPandoc :: (PandocEffects effs, Member Pandocs effs) => Text -> Sem (ToPandoc : effs) () -> Sem effs ()
- Knit.Effect.Pandoc: pandocsToNamed :: PandocEffects effs => PandocWriteFormat a -> WriterOptions -> Semantic (Pandocs : effs) () -> Semantic effs [NamedDoc a]
+ Knit.Effect.Pandoc: pandocsToNamed :: PandocEffects effs => PandocWriteFormat a -> WriterOptions -> Sem (Pandocs : effs) () -> Sem effs [NamedDoc a]
- Knit.Effect.Pandoc: require :: Member ToPandoc effs => Requirement -> Semantic effs ()
+ Knit.Effect.Pandoc: require :: Member ToPandoc effs => Requirement -> Sem effs ()
- Knit.Effect.Pandoc: runPandocWriter :: PandocEffects effs => Semantic (ToPandoc : effs) () -> Semantic effs PandocWithRequirements
+ Knit.Effect.Pandoc: runPandocWriter :: PandocEffects effs => Sem (ToPandoc : effs) () -> Sem effs PandocWithRequirements
- Knit.Effect.Pandoc: writeTo :: Member FromPandoc effs => PandocWriteFormat a -> WriterOptions -> Pandoc -> Semantic effs a
+ Knit.Effect.Pandoc: writeTo :: Member FromPandoc effs => PandocWriteFormat a -> WriterOptions -> Pandoc -> Sem effs a
- Knit.Effect.PandocMonad: fileExists :: forall r_ata8. Member Pandoc r_ata8 => FilePath -> Semantic r_ata8 Bool
+ Knit.Effect.PandocMonad: fileExists :: forall r_at8f. Member Pandoc r_at8f => FilePath -> Sem r_at8f Bool
- Knit.Effect.PandocMonad: getCommonState :: forall r_atab. Member Pandoc r_atab => Semantic r_atab CommonState
+ Knit.Effect.PandocMonad: getCommonState :: forall r_at8i. Member Pandoc r_at8i => Sem r_at8i CommonState
- Knit.Effect.PandocMonad: getCurrentTime :: forall r_ata0. Member Pandoc r_ata0 => Semantic r_ata0 UTCTime
+ Knit.Effect.PandocMonad: getCurrentTime :: forall r_at87. Member Pandoc r_at87 => Sem r_at87 UTCTime
- Knit.Effect.PandocMonad: getCurrentTimeZone :: forall r_ata1. Member Pandoc r_ata1 => Semantic r_ata1 TimeZone
+ Knit.Effect.PandocMonad: getCurrentTimeZone :: forall r_at88. Member Pandoc r_at88 => Sem r_at88 TimeZone
- Knit.Effect.PandocMonad: getDataFileName :: forall r_ata9. Member Pandoc r_ata9 => FilePath -> Semantic r_ata9 FilePath
+ Knit.Effect.PandocMonad: getDataFileName :: forall r_at8g. Member Pandoc r_at8g => FilePath -> Sem r_at8g FilePath
- Knit.Effect.PandocMonad: getModificationTime :: forall r_ataa. Member Pandoc r_ataa => FilePath -> Semantic r_ataa UTCTime
+ Knit.Effect.PandocMonad: getModificationTime :: forall r_at8h. Member Pandoc r_at8h => FilePath -> Sem r_at8h UTCTime
- Knit.Effect.PandocMonad: getsCommonState :: forall a_asPO. forall r_atad. Member Pandoc r_atad => (CommonState -> a_asPO) -> Semantic r_atad a_asPO
+ Knit.Effect.PandocMonad: getsCommonState :: forall a_asNV. forall r_at8k. Member Pandoc r_at8k => (CommonState -> a_asNV) -> Sem r_at8k a_asNV
- Knit.Effect.PandocMonad: glob :: forall r_ata7. Member Pandoc r_ata7 => String -> Semantic r_ata7 [FilePath]
+ Knit.Effect.PandocMonad: glob :: forall r_at8e. Member Pandoc r_at8e => String -> Sem r_at8e [FilePath]
- Knit.Effect.PandocMonad: interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Lift IO) effs, Member (Error PandocError) effs) => Semantic (Pandoc : effs) a -> Semantic effs a
+ Knit.Effect.PandocMonad: interpretInIO :: forall effs a. (Member (Logger LogEntry) effs, Member (Lift IO) effs, Member (Error PandocError) effs) => Sem (Pandoc : effs) a -> Sem effs a
- Knit.Effect.PandocMonad: interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Semantic (Pandoc : effs) a -> Semantic effs a
+ Knit.Effect.PandocMonad: interpretInPandocMonad :: forall m effs a. (PandocMonad m, Member (Lift m) effs, Member (Logger LogEntry) effs) => Sem (Pandoc : effs) a -> Sem effs a
- Knit.Effect.PandocMonad: logOutput :: forall r_ataf. Member Pandoc r_ataf => LogMessage -> Semantic r_ataf ()
+ Knit.Effect.PandocMonad: logOutput :: forall r_at8m. Member Pandoc r_at8m => LogMessage -> Sem r_at8m ()
- Knit.Effect.PandocMonad: lookupEnv :: forall r_at9Z. Member Pandoc r_at9Z => String -> Semantic r_at9Z (Maybe String)
+ Knit.Effect.PandocMonad: lookupEnv :: forall r_at86. Member Pandoc r_at86 => String -> Sem r_at86 (Maybe String)
- Knit.Effect.PandocMonad: modifyCommonState :: forall r_atae. Member Pandoc r_atae => (CommonState -> CommonState) -> Semantic r_atae ()
+ Knit.Effect.PandocMonad: modifyCommonState :: forall r_at8l. Member Pandoc r_at8l => (CommonState -> CommonState) -> Sem r_at8l ()
- Knit.Effect.PandocMonad: newStdGen :: forall r_ata2. Member Pandoc r_ata2 => Semantic r_ata2 StdGen
+ Knit.Effect.PandocMonad: newStdGen :: forall r_at89. Member Pandoc r_at89 => Sem r_at89 StdGen
- Knit.Effect.PandocMonad: newUniqueHash :: forall r_ata3. Member Pandoc r_ata3 => Semantic r_ata3 Int
+ Knit.Effect.PandocMonad: newUniqueHash :: forall r_at8a. Member Pandoc r_at8a => Sem r_at8a Int
- Knit.Effect.PandocMonad: openURL :: forall r_ata4. Member Pandoc r_ata4 => String -> Semantic r_ata4 (ByteString, Maybe MimeType)
+ Knit.Effect.PandocMonad: openURL :: forall r_at8b. Member Pandoc r_at8b => String -> Sem r_at8b (ByteString, Maybe MimeType)
- Knit.Effect.PandocMonad: putCommonState :: forall r_atac. Member Pandoc r_atac => CommonState -> Semantic r_atac ()
+ Knit.Effect.PandocMonad: putCommonState :: forall r_at8j. Member Pandoc r_at8j => CommonState -> Sem r_at8j ()
- Knit.Effect.PandocMonad: readFileLazy :: forall r_ata5. Member Pandoc r_ata5 => FilePath -> Semantic r_ata5 ByteString
+ Knit.Effect.PandocMonad: readFileLazy :: forall r_at8c. Member Pandoc r_at8c => FilePath -> Sem r_at8c ByteString
- Knit.Effect.PandocMonad: readFileStrict :: forall r_ata6. Member Pandoc r_ata6 => FilePath -> Semantic r_ata6 ByteString
+ Knit.Effect.PandocMonad: readFileStrict :: forall r_at8d. Member Pandoc r_at8d => FilePath -> Sem r_at8d ByteString
- Knit.Effect.PandocMonad: runIO :: [LogSeverity] -> Semantic '[Pandoc, Logger LogEntry, PrefixLog, Error PandocError, Lift IO] a -> IO (Either PandocError a)
+ Knit.Effect.PandocMonad: runIO :: [LogSeverity] -> Sem '[Pandoc, Logger LogEntry, PrefixLog, Error PandocError, Lift IO] a -> IO (Either PandocError a)
- Knit.Effect.PandocMonad: trace :: forall r_atag. Member Pandoc r_atag => String -> Semantic r_atag ()
+ Knit.Effect.PandocMonad: trace :: forall r_at8n. Member Pandoc r_at8n => String -> Sem r_at8n ()
- Knit.Effect.RandomFu: runRandomFromSource :: forall s effs a. RandomSource (Semantic effs) s => s -> Semantic (Random : effs) a -> Semantic effs a
+ Knit.Effect.RandomFu: runRandomFromSource :: forall s effs a. RandomSource (Sem effs) s => s -> Sem (Random : effs) a -> Sem effs a
- Knit.Effect.RandomFu: runRandomIOPureMT :: MonadIO (Semantic effs) => PureMT -> Semantic (Random : effs) a -> Semantic effs a
+ Knit.Effect.RandomFu: runRandomIOPureMT :: MonadIO (Sem effs) => PureMT -> Sem (Random : effs) a -> Sem effs a
- Knit.Effect.RandomFu: runRandomIOSimple :: forall effs a. MonadIO (Semantic effs) => Semantic (Random : effs) a -> Semantic effs a
+ Knit.Effect.RandomFu: runRandomIOSimple :: forall effs a. MonadIO (Sem effs) => Sem (Random : effs) a -> Sem effs a
- Knit.Effect.RandomFu: sampleDist :: (Member Random effs, Distribution d t) => d t -> Semantic effs t
+ Knit.Effect.RandomFu: sampleDist :: (Member Random effs, Distribution d t) => d t -> Sem effs t
- Knit.Effect.RandomFu: sampleRVar :: Member Random effs => RVar t -> Semantic effs t
+ Knit.Effect.RandomFu: sampleRVar :: Member Random effs => RVar t -> Sem effs t
- Knit.Report: addBlaze :: (PandocEffects effs, Member ToPandoc effs) => Html -> Semantic effs ()
+ Knit.Report: addBlaze :: (PandocEffects effs, Member ToPandoc effs) => Html -> Sem effs ()
- Knit.Report: addColonnadeCellTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Cell -> f a -> Semantic effs ()
+ Knit.Report: addColonnadeCellTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Cell -> f a -> Sem effs ()
- Knit.Report: addColonnadeHtmlTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Html -> f a -> Semantic effs ()
+ Knit.Report: addColonnadeHtmlTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Html -> f a -> Sem effs ()
- Knit.Report: addColonnadeTextTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Colonnade Headed a Text -> f a -> Semantic effs ()
+ Knit.Report: addColonnadeTextTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Colonnade Headed a Text -> f a -> Sem effs ()
- Knit.Report: addHvega :: (PandocEffects effs, Member ToPandoc effs) => Text -> VegaLite -> Semantic effs ()
+ Knit.Report: addHvega :: (PandocEffects effs, Member ToPandoc effs) => Text -> VegaLite -> Sem effs ()
- Knit.Report: addLatex :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report: addLatex :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report: addLazyTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report: addLazyTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report: addLucid :: (PandocEffects effs, Member ToPandoc effs) => Html () -> Semantic effs ()
+ Knit.Report: addLucid :: (PandocEffects effs, Member ToPandoc effs) => Html () -> Sem effs ()
- Knit.Report: addMarkDown :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report: addMarkDown :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report: addStrictTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report: addStrictTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report: filteredLogEntriesToIO :: MonadIO (Semantic effs) => [LogSeverity] -> Semantic (Logger LogEntry : (PrefixLog : effs)) x -> Semantic effs x
+ Knit.Report: filteredLogEntriesToIO :: MonadIO (Sem effs) => [LogSeverity] -> Sem (Logger LogEntry : (PrefixLog : effs)) x -> Sem effs x
- Knit.Report: knitHtml :: forall m. (MonadIO m, LastMember (Lift m) (KnitEffectStack m)) => Maybe Text -> [LogSeverity] -> PandocWriterConfig -> Semantic (KnitEffectDocStack m) () -> m (Either PandocError Text)
+ Knit.Report: knitHtml :: MonadIO m => Maybe Text -> [LogSeverity] -> PandocWriterConfig -> Sem (KnitEffectDocStack m) () -> m (Either PandocError Text)
- Knit.Report: knitHtmls :: forall m. (MonadIO m, LastMember (Lift m) (KnitEffectStack m)) => Maybe Text -> [LogSeverity] -> PandocWriterConfig -> Semantic (KnitEffectDocsStack m) () -> m (Either PandocError [NamedDoc Text])
+ Knit.Report: knitHtmls :: MonadIO m => Maybe Text -> [LogSeverity] -> PandocWriterConfig -> Sem (KnitEffectDocsStack m) () -> m (Either PandocError [NamedDoc Text])
- Knit.Report: liftKnit :: Member (Lift m) r => m a -> Semantic r a
+ Knit.Report: liftKnit :: Member (Lift m) r => m a -> Sem r a
- Knit.Report: logLE :: Member (Logger LogEntry) effs => LogSeverity -> Text -> Semantic effs ()
+ Knit.Report: logLE :: Member (Logger LogEntry) effs => LogSeverity -> Text -> Sem effs ()
- Knit.Report: pandocWriterToBlazeDocument :: PandocEffects effs => PandocWriterConfig -> Semantic (ToPandoc : effs) () -> Semantic effs Html
+ Knit.Report: pandocWriterToBlazeDocument :: PandocEffects effs => PandocWriterConfig -> Sem (ToPandoc : effs) () -> Sem effs Html
- Knit.Report: wrapPrefix :: Member PrefixLog effs => Text -> Semantic effs a -> Semantic effs a
+ Knit.Report: wrapPrefix :: Member PrefixLog effs => Text -> Sem effs a -> Sem effs a
- Knit.Report.Input.Html: addLazyTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report.Input.Html: addLazyTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report.Input.Html: addStrictTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report.Input.Html: addStrictTextHtml :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report.Input.Html.Blaze: addBlaze :: (PandocEffects effs, Member ToPandoc effs) => Html -> Semantic effs ()
+ Knit.Report.Input.Html.Blaze: addBlaze :: (PandocEffects effs, Member ToPandoc effs) => Html -> Sem effs ()
- Knit.Report.Input.Html.Lucid: addLucid :: (PandocEffects effs, Member ToPandoc effs) => Html () -> Semantic effs ()
+ Knit.Report.Input.Html.Lucid: addLucid :: (PandocEffects effs, Member ToPandoc effs) => Html () -> Sem effs ()
- Knit.Report.Input.Latex: addLatex :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report.Input.Latex: addLatex :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report.Input.MarkDown.PandocMarkDown: addMarkDown :: (PandocEffects effs, Member ToPandoc effs) => Text -> Semantic effs ()
+ Knit.Report.Input.MarkDown.PandocMarkDown: addMarkDown :: (PandocEffects effs, Member ToPandoc effs) => Text -> Sem effs ()
- Knit.Report.Input.MarkDown.PandocMarkDown: addMarkDownWithOptions :: (PandocEffects effs, Member ToPandoc effs) => ReaderOptions -> Text -> Semantic effs ()
+ Knit.Report.Input.MarkDown.PandocMarkDown: addMarkDownWithOptions :: (PandocEffects effs, Member ToPandoc effs) => ReaderOptions -> Text -> Sem effs ()
- Knit.Report.Input.Table.Colonnade: addColonnadeCellTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Cell -> f a -> Semantic effs ()
+ Knit.Report.Input.Table.Colonnade: addColonnadeCellTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Cell -> f a -> Sem effs ()
- Knit.Report.Input.Table.Colonnade: addColonnadeHtmlTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Html -> f a -> Semantic effs ()
+ Knit.Report.Input.Table.Colonnade: addColonnadeHtmlTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Attribute -> Colonnade Headed a Html -> f a -> Sem effs ()
- Knit.Report.Input.Table.Colonnade: addColonnadeTextTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Colonnade Headed a Text -> f a -> Semantic effs ()
+ Knit.Report.Input.Table.Colonnade: addColonnadeTextTable :: (PandocEffects effs, Member ToPandoc effs, Foldable f) => Colonnade Headed a Text -> f a -> Sem effs ()
- Knit.Report.Input.Visualization.Hvega: addHvega :: (PandocEffects effs, Member ToPandoc effs) => Text -> VegaLite -> Semantic effs ()
+ Knit.Report.Input.Visualization.Hvega: addHvega :: (PandocEffects effs, Member ToPandoc effs) => Text -> VegaLite -> Sem effs ()
- Knit.Report.Output.Html: markDownTextToBlazeFragment :: PandocEffects effs => Text -> Semantic effs Html
+ Knit.Report.Output.Html: markDownTextToBlazeFragment :: PandocEffects effs => Text -> Sem effs Html
- Knit.Report.Output.Html: pandocWriterToBlazeDocument :: PandocEffects effs => PandocWriterConfig -> Semantic (ToPandoc : effs) () -> Semantic effs Html
+ Knit.Report.Output.Html: pandocWriterToBlazeDocument :: PandocEffects effs => PandocWriterConfig -> Sem (ToPandoc : effs) () -> Sem effs Html
- Knit.Report.Output.Html: toBlazeDocument :: PandocEffects effs => PandocWriterConfig -> PandocWithRequirements -> Semantic effs Html
+ Knit.Report.Output.Html: toBlazeDocument :: PandocEffects effs => PandocWriterConfig -> PandocWithRequirements -> Sem effs Html
Files
- ChangeLog.md +8/−0
- examples/MtlExample.hs +1/−1
- examples/MultiDocExample.hs +91/−0
- examples/RandomExample.hs +1/−1
- examples/SimpleExample.hs +1/−1
- knit-haskell.cabal +18/−4
- src/Knit/Effect/Docs.hs +6/−16
- src/Knit/Effect/Html.hs +12/−12
- src/Knit/Effect/Logger.hs +20/−47
- src/Knit/Effect/Pandoc.hs +14/−14
- src/Knit/Effect/PandocMonad.hs +16/−19
- src/Knit/Effect/RandomFu.hs +15/−16
- src/Knit/Report.hs +27/−88
- src/Knit/Report/Input/Html.hs +2/−2
- src/Knit/Report/Input/Html/Blaze.hs +4/−4
- src/Knit/Report/Input/Html/Lucid.hs +4/−4
- src/Knit/Report/Input/Latex.hs +3/−3
- src/Knit/Report/Input/MarkDown/PandocMarkDown.hs +2/−2
- src/Knit/Report/Input/Table/Colonnade.hs +3/−7
- src/Knit/Report/Input/Visualization/Hvega.hs +1/−1
- src/Knit/Report/Output/Html.hs +4/−4
ChangeLog.md view
@@ -1,2 +1,10 @@ v 0.1.0.0 * Initial version++v 0.2.0.0+* Documentation Fixes+* Added export of newPandoc and NamedDoc to Knit.Report to facilitate multi-doc use.+* Removed redundant imports from Knit.Report.Input.Table.Colonnade+* Added a multi-doc example+* (internal) Removed odd, and no longer necessary, "LastMember" constraint from knit functions. +* Updated effects for polysemy 1.2
examples/MtlExample.hs view
@@ -61,7 +61,7 @@ makeDoc :: (K.Member K.ToPandoc effs , K.PandocEffects effs- , K.KnitBase ExampleApp effs) => K.Semantic effs ()+ , K.KnitBase ExampleApp effs) => K.Sem effs () makeDoc = K.wrapPrefix "makeDoc" $ do K.logLE K.Info "adding some markdown..." K.addMarkDown md1
+ examples/MultiDocExample.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE GADTs #-}+module Main where++import qualified Knit.Report as K ++import qualified Data.Map as M+import qualified Data.Text.IO as T+import qualified Data.Text.Lazy as TL+import qualified Data.Text as T+import Data.String.Here (here)+import qualified Graphics.Vega.VegaLite as V++templateVars :: M.Map String String+templateVars = M.fromList+ [ ("lang" , "English")+ , ("author" , "Adam Conner-Sax")+ , ("pagetitle", "knit-haskell simple multi-doc example")+-- , ("tufte","True")+ ]++main :: IO ()+main = do+ let writeNamedHtml (K.NamedDoc n lt) = T.writeFile (T.unpack $ "examples/html/" <> n <> ".html") $ TL.toStrict lt+ writeAllHtml = fmap (const ()) . traverse writeNamedHtml+ pandocWriterConfig = K.PandocWriterConfig (Just "pandoc-templates/minWithVega-pandoc.html") templateVars K.mindocOptionsF+ resE <- K.knitHtmls (Just "SimpleExample.Main") K.logAll pandocWriterConfig $ do+ K.newPandoc "multi_doc1" makeDoc1+ K.newPandoc "multi_doc2" makeDoc2+ case resE of+ Right namedDocs -> writeAllHtml namedDocs + Left err -> putStrLn $ "pandoc error: " ++ show err+ +md1 :: T.Text+md1 = [here|+## Some example markdown+* [Markdown][MarkdownLink] is a nice way to write formatted notes with a minimum of code.+* It supports links and tables and some *styling* information.++[MarkDownLink]:<https://pandoc.org/MANUAL.html#pandocs-markdown>+|]++makeDoc1 :: (K.Member K.ToPandoc effs -- required for the single-document variant+ , K.PandocEffects effs -- all effects for knitting+ ) + => K.Sem effs ()+makeDoc1 = K.wrapPrefix "makeDoc1" $ do+ K.logLE K.Info "adding some markdown."+ K.addMarkDown md1+ K.logLE K.Info "adding some latex."+ K.addMarkDown "## Some example latex (Doc 1)"+ K.addLatex "Overused favorite equation: $e^{i\\pi} + 1 = 0$"+ K.logLE K.Info "adding a visualization."+ K.addMarkDown "## An example hvega visualization (Doc 1)"+ K.addHvega "someID" exampleVis++md2 :: T.Text+md2 = [here|+## Some example markdown+* This is some more markdown! Now for document 2. It's still a nice way to write formatted notes with a minimum of code.+* It supports links and tables and some *styling* information.++[MarkDownLink]:<https://pandoc.org/MANUAL.html#pandocs-markdown>+|]++makeDoc2 :: (K.Member K.ToPandoc effs -- required for the single-document variant+ , K.PandocEffects effs -- all effects for knitting+ ) + => K.Sem effs ()+makeDoc2 = K.wrapPrefix "makeDoc2" $ do+ K.logLE K.Info "adding some markdown."+ K.addMarkDown md2+ K.logLE K.Info "adding some latex."+ K.addMarkDown "## Some example latex (Doc 2)"+ K.addLatex "A different equation: $a^2 + b^2 = c^2$"+ K.logLE K.Info "adding a visualization."+ K.addMarkDown "## An example hvega visualization (Doc 2)"+ K.addHvega "someID" exampleVis ++exampleVis :: V.VegaLite+exampleVis =+ let cars = V.dataFromUrl "https://vega.github.io/vega-datasets/data/cars.json" []+ enc = V.encoding+ . V.position V.X [ V.PName "Horsepower", V.PmType V.Quantitative ]+ . V.position V.Y [ V.PName "Miles_per_Gallon", V.PmType V.Quantitative ]+ . V.color [ V.MName "Origin", V.MmType V.Nominal ]+ bkg = V.background "rgba(0, 0, 0, 0.05)"+ in V.toVegaLite [ bkg, cars, V.mark V.Circle [], enc [] ]
examples/RandomExample.hs view
@@ -69,7 +69,7 @@ makeDoc :: (K.Member K.ToPandoc effs , K.PandocEffects effs , K.Member KR.Random effs -- this one needs to be handled before knitting- , K.KnitBase ExampleApp effs) => K.Semantic effs ()+ , K.KnitBase ExampleApp effs) => K.Sem effs () makeDoc = K.wrapPrefix "makeDoc" $ do K.logLE K.Info "adding some markdown..." K.addMarkDown md1
examples/SimpleExample.hs view
@@ -45,7 +45,7 @@ makeDoc :: (K.Member K.ToPandoc effs -- required for the single-document variant , K.PandocEffects effs -- all effects for knitting ) - => K.Semantic effs ()+ => K.Sem effs () makeDoc = K.wrapPrefix "makeDoc" $ do K.logLE K.Info "adding some markdown..." K.addMarkDown md1
knit-haskell.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: knit-haskell-version: 0.1.0.0+version: 0.2.0.0 synopsis: a minimal Rmarkdown sort-of-thing for haskell, by way of Pandoc description: knit-haskell is a beginning attempt at bringing some of the benefits of Rmarkdown to Haskell.@@ -35,7 +35,7 @@ Location: https://github.com/adamConnerSax/knit-haskell library- ghc-options: -Wall -funbox-strict-fields+ ghc-options: -Wall -fno-warn-unused-top-binds -funbox-strict-fields exposed-modules: Knit.Effect.Logger , Knit.Effect.Docs , Knit.Effect.Html@@ -71,13 +71,13 @@ network >= 2.8.0.0 && < 3.1.0.0, network-uri >= 2.6.1.0 && < 2.7.0.0, text >= 1.2.3 && < 1.3,- time >= 1.8.0 && < 1.9,+ time >= 1.8.0 && < 2.0.0, random >= 1.1 && < 1.2, blaze-html >= 0.9.1 && < 0.10, hvega >= 0.1.0 && <= 0.2.0.0, logging-effect >= 1.3.3 && < 1.4, mtl >= 2.2.2 && < 2.3,- polysemy >= 0.1.1.0 && < 0.2.0.0,+ polysemy >= 0.1.2.0 && < 0.2.0.0, prettyprinter >= 1.2.1 && < 1.3, lucid >= 2.9.11 && < 2.10, pandoc >= 2.7.2 && < 2.8,@@ -90,6 +90,20 @@ executable SimpleExample main-is: SimpleExample.hs+ hs-source-dirs: examples+ ghc-options: -Wall + build-depends: base,+ blaze-html,+ containers,+ here >= 1.2.10 && < 1.3.0,+ hvega, + knit-haskell -any,+ polysemy, + text + default-language: Haskell2010++executable MultiDocExample+ main-is: MultiDocExample.hs hs-source-dirs: examples ghc-options: -Wall build-depends: base,
src/Knit/Effect/Docs.hs view
@@ -54,7 +54,7 @@ NewDoc :: T.Text -> a -> Docs a m () -- | Action of the 'Docs' Effect. Store a named document.-newDoc :: P.Member (Docs a) effs => T.Text -> a -> P.Semantic effs ()+newDoc :: P.Member (Docs a) effs => T.Text -> a -> P.Sem effs () newDoc name doc = send $ NewDoc name doc -- | Data type to hold one named document of type @a@. @@ -62,18 +62,14 @@ -- | Intepret 'Docs' in @Polysemy.Writer [NamedDoc a]' toWriter- :: P.Semantic (Docs a ': effs) ()- -> P.Semantic (P.Writer [NamedDoc a] ': effs) ()+ :: P.Sem (Docs a ': effs) () -> P.Sem (P.Writer [NamedDoc a] ': effs) () toWriter = P.reinterpret f where- f :: Docs a m x -> P.Semantic (P.Writer [NamedDoc a] ': effs) x+ f :: Docs a m x -> P.Sem (P.Writer [NamedDoc a] ': effs) x f (NewDoc n d) = P.tell [NamedDoc n d] -- | Interpret 'Docs' (via 'Polysemy.Writer'), producing a list of @NamedDoc a@-toNamedDocList- :: P.Typeable a- => P.Semantic (Docs a ': effs) ()- -> P.Semantic effs [NamedDoc a]+toNamedDocList :: P.Sem (Docs a ': effs) () -> P.Sem effs [NamedDoc a] toNamedDocList = fmap fst . P.runWriter . toWriter -- | Map over the doc part of @Functor m => m [NamedDoc a]@ with an @a->b@ resulting in @m [NamedDoc b]@@@ -86,17 +82,11 @@ -- | Combine the interpretation and mapping step. Commonly used to "run" the effect and map the results to your deisred output format. toNamedDocListWith- :: P.Typeable a- => (a -> b)- -> P.Semantic (Docs a ': effs) ()- -> P.Semantic effs [NamedDoc b]+ :: (a -> b) -> P.Sem (Docs a ': effs) () -> P.Sem effs [NamedDoc b] toNamedDocListWith f = mapNamedDocs f . toNamedDocList -- | Combine the interpretation and effectful mapping step. Commonly used to "run" the effect and map the results to your deisred output format. toNamedDocListWithM- :: P.Typeable a- => (a -> P.Semantic effs b)- -> P.Semantic (Docs a ': effs) ()- -> P.Semantic effs [NamedDoc b]+ :: (a -> P.Sem effs b) -> P.Sem (Docs a ': effs) () -> P.Sem effs [NamedDoc b] toNamedDocListWithM f = mapNamedDocsM f . toNamedDocList
src/Knit/Effect/Html.hs view
@@ -78,11 +78,11 @@ type Blaze = P.Writer BH.Html -- | Add a Lucid html fragment to the current Lucid doc.-lucid :: P.Member Lucid effs => LH.Html () -> P.Semantic effs ()+lucid :: P.Member Lucid effs => LH.Html () -> P.Sem effs () lucid = P.tell -- | Add a Blaze html fragment to the current Blaze doc.-blaze :: P.Member Blaze effs => BH.Html -> P.Semantic effs ()+blaze :: P.Member Blaze effs => BH.Html -> P.Sem effs () blaze = P.tell -- | Type-Alias for the 'Knit.Effects.Docs' effect (multi-document Writer), specialized to Lucid docs.@@ -99,8 +99,8 @@ newLucidDoc :: P.Member LucidDocs effs => T.Text- -> P.Semantic (Lucid ': effs) ()- -> P.Semantic effs ()+ -> P.Sem (Lucid ': effs) ()+ -> P.Sem effs () newLucidDoc n l = (fmap fst $ P.runWriter l) >>= newDoc n -- | take the current Blaze HTML in the writer and add it to the set of named docs with the given name@@ -109,33 +109,33 @@ newBlazeDoc :: P.Member BlazeDocs effs => T.Text- -> P.Semantic (Blaze ': effs) ()- -> P.Semantic effs ()+ -> P.Sem (Blaze ': effs) ()+ -> P.Sem effs () newBlazeDoc n l = (fmap fst $ P.runWriter l) >>= newDoc n -- | Interpret the LucidDocs effect (via Writer), producing a list of named Lucid docs, suitable for writing to disk. lucidToNamedText- :: P.Semantic (LucidDocs ': effs) () -> P.Semantic effs [NamedDoc TL.Text]+ :: P.Sem (LucidDocs ': effs) () -> P.Sem effs [NamedDoc TL.Text] lucidToNamedText = fmap (fmap (fmap LH.renderText)) . toNamedDocList -- monad, list, NamedDoc itself -- | Interpret the BlazeDocs effect (via Writer), producing a list of named Blaze docs. blazeToNamedText- :: P.Semantic (BlazeDocs ': effs) () -> P.Semantic effs [NamedDoc TL.Text]+ :: P.Sem (BlazeDocs ': effs) () -> P.Sem effs [NamedDoc TL.Text] blazeToNamedText = fmap (fmap (fmap BH.renderHtml)) . toNamedDocList -- monad, list, NamedDoc itself -- | Interprest the Lucid effect (via Writer), producing a Lucid @Html ()@ from the currently written doc-lucidHtml :: P.Semantic (Lucid ': effs) () -> P.Semantic effs (LH.Html ())+lucidHtml :: P.Sem (Lucid ': effs) () -> P.Sem effs (LH.Html ()) lucidHtml = fmap fst . P.runWriter -- | Interpret the Lucid effect (via Writer), producing @Text@ from the currently written doc-lucidToText :: P.Semantic (Lucid ': effs) () -> P.Semantic effs TL.Text+lucidToText :: P.Sem (Lucid ': effs) () -> P.Sem effs TL.Text lucidToText = fmap LH.renderText . lucidHtml -- | Interpret the Blaze effect (via Writer), producing a Blaze @Html@ from the currently written doc.-blazeHtml :: P.Semantic (Blaze ': effs) () -> P.Semantic effs BH.Html+blazeHtml :: P.Sem (Blaze ': effs) () -> P.Sem effs BH.Html blazeHtml = fmap fst . P.runWriter -- | Interpret the Blaze effect (via Writer), producing @Text@ from the currently written doc.-blazeToText :: P.Semantic (Blaze ': effs) () -> P.Semantic effs TL.Text+blazeToText :: P.Sem (Blaze ': effs) () -> P.Sem effs TL.Text blazeToText = fmap BH.renderHtml . blazeHtml
src/Knit/Effect/Logger.hs view
@@ -54,7 +54,7 @@ , LogWithPrefixesLE -- * Re-Exports- , Semantic+ , Sem , Member , Handler )@@ -62,7 +62,7 @@ import qualified Polysemy as P import Polysemy ( Member- , Semantic+ , Sem ) import Polysemy.Internal ( send ) import qualified Polysemy.State as P@@ -122,22 +122,17 @@ Log :: a -> Logger a m () -- | Add one log entry of arbitrary type. If you want to log with another type besides @LogEntry.-log :: P.Member (Logger a) effs => a -> P.Semantic effs ()+log :: P.Member (Logger a) effs => a -> P.Sem effs () log = send . Log -- | Add one log-entry of the @LogEntry@ type. logLE- :: P.Member (Logger LogEntry) effs- => LogSeverity- -> T.Text- -> P.Semantic effs ()+ :: P.Member (Logger LogEntry) effs => LogSeverity -> T.Text -> P.Sem effs () logLE ls lm = log (LogEntry ls lm) -- | Helper function for logging with monad-logger handler. logWithHandler- :: Handler (P.Semantic effs) a- -> P.Semantic (Logger a ': effs) x- -> P.Semantic effs x+ :: Handler (P.Sem effs) a -> P.Sem (Logger a ': effs) x -> P.Sem effs x logWithHandler handler = P.interpret (\(Log a) -> handler a) -- | Prefix Effect@@ -147,20 +142,19 @@ GetPrefix :: PrefixLog m T.Text -- ^ Represents retrieving the current prefix -- | Add one level of prefix.-addPrefix :: P.Member PrefixLog effs => T.Text -> P.Semantic effs ()+addPrefix :: P.Member PrefixLog effs => T.Text -> P.Sem effs () addPrefix = send . AddPrefix -- | Remove last prefix.-removePrefix :: P.Member PrefixLog effs => P.Semantic effs ()+removePrefix :: P.Member PrefixLog effs => P.Sem effs () removePrefix = send RemovePrefix -- | Get current prefix -getPrefix :: P.Member PrefixLog effs => P.Semantic effs T.Text+getPrefix :: P.Member PrefixLog effs => P.Sem effs T.Text getPrefix = send $ GetPrefix -- | Add a prefix for the block of code.-wrapPrefix- :: P.Member PrefixLog effs => T.Text -> P.Semantic effs a -> P.Semantic effs a+wrapPrefix :: P.Member PrefixLog effs => T.Text -> P.Sem effs a -> P.Sem effs a wrapPrefix p l = do addPrefix p res <- l@@ -170,15 +164,15 @@ -- | Interpret LogPrefix in @Polysemy.State [T.Text]@. prefixInState :: forall effs a- . P.Semantic (PrefixLog ': effs) a- -> P.Semantic (P.State [T.Text] ': effs) a+ . P.Sem (PrefixLog ': effs) a+ -> P.Sem (P.State [T.Text] ': effs) a prefixInState = P.reinterpret $ \case AddPrefix t -> P.modify (t :) RemovePrefix -> P.modify @[T.Text] tail -- type application required here since tail is polymorphic GetPrefix -> fmap (T.intercalate "." . List.reverse) P.get -- | Interpret the 'LogPrefix' effect in State and run that.-runPrefix :: P.Semantic (PrefixLog ': effs) a -> P.Semantic effs a+runPrefix :: P.Sem (PrefixLog ': effs) a -> P.Sem effs a runPrefix = fmap snd . P.runState [] . prefixInState -- | Monad-logger style wrapper to add prefixes to log messages.@@ -191,8 +185,8 @@ -- | Use @PrefixLog@ Effect to re-interpret all the logged messages to WithPrefix form. logPrefixed :: P.Member PrefixLog effs- => P.Semantic (Logger a ': effs) x- -> P.Semantic (Logger (WithPrefix a) ': effs) x+ => P.Sem (Logger a ': effs) x+ -> P.Sem (Logger (WithPrefix a) ': effs) x logPrefixed = P.reinterpret (\(Log a) -> getPrefix >>= (\p -> log (WithPrefix p a))) @@ -202,9 +196,9 @@ -- messages via that handler. logAndHandlePrefixed :: forall effs a x- . Handler (P.Semantic effs) (WithPrefix a)- -> P.Semantic (Logger a ': (PrefixLog ': effs)) x- -> P.Semantic effs x+ . Handler (P.Sem effs) (WithPrefix a)+ -> P.Sem (Logger a ': (PrefixLog ': effs)) x+ -> P.Sem effs x logAndHandlePrefixed handler = runPrefix . logWithHandler (P.raise . handler)@@ -233,10 +227,10 @@ -- | Run the Logger and PrefixLog effects using the preferred handler and filter output in any Polysemy monad with IO in the union. filteredLogEntriesToIO- :: MonadIO (P.Semantic effs)+ :: MonadIO (P.Sem effs) => [LogSeverity]- -> P.Semantic (Logger LogEntry ': (PrefixLog ': effs)) x- -> P.Semantic effs x+ -> P.Sem (Logger LogEntry ': (PrefixLog ': effs)) x+ -> P.Sem effs x filteredLogEntriesToIO lss = logAndHandlePrefixed (filterLog f lss $ prefixedLogEntryToIO) where f lss' a = (severity $ discardPrefix a) `List.elem` lss'@@ -247,24 +241,3 @@ -- | Constraint helper for @LogEntry@ type with prefixes type LogWithPrefixesLE effs = LogWithPrefixes LogEntry effs --(P.Member PrefixLog effs, P.Member (Logger a) effs) -{--TODO: Working instance of logging-effect MonadLog. Maybe.--• Illegal instance declaration for- ‘ML.MonadLog a (P.Semantic effs)’- The liberal coverage condition fails in class ‘ML.MonadLog’- for functional dependency: ‘m -> message’- Reason: lhs type ‘P.Semantic effs’ does not determine rhs type ‘a’- Un-determined variable: a- • In the instance declaration for ‘ML.MonadLog a (P.Semantic effs)’----- not sure how to use this in practice but we might need it if we call a function with a MonadLog constraint.--- | instance to support using an existing function with a MonadLog constraint from a freer-simple stack. -instance (ML.MonadLog a m, P.Member (P.Lift m) effs) => ML.MonadLog a (P.Semantic effs) where- logMessageFree :: (ML.MonadLog a m, P.Member (P.Lift m) effs,forall n. Monoid n => (a -> n) -> n) -> P.Semantic effs ()- logMessageFree inj = P.sendM @m $ ML.logMessageFree inj--instance (P.Member (Logger a) effs) => ML.MonadLog a (P.Semantic effs) where- logMessageFree inj = mapM_ log (inj $ pure @[])--}
src/Knit/Effect/Pandoc.hs view
@@ -161,11 +161,11 @@ => PandocReadFormat a -> PA.ReaderOptions -> a- -> P.Semantic effs ()+ -> P.Sem effs () addFrom prf pro doc' = send $ AddFrom prf pro doc' -- | Add a requirement that the output format must satisfy.-require :: P.Member ToPandoc effs => Requirement -> P.Semantic effs ()+require :: P.Member ToPandoc effs => Requirement -> P.Sem effs () require r = send $ Require r -- | Write given doc in requested format@@ -174,7 +174,7 @@ => PandocWriteFormat a -> PA.WriterOptions -> PA.Pandoc- -> P.Semantic effs a+ -> P.Sem effs a writeTo pwf pwo pdoc = send $ WriteTo pwf pwo pdoc -- | Convert a to Pandoc with the given options@@ -224,8 +224,8 @@ -- | Re-interpret ToPandoc in Writer toWriter :: PM.PandocEffects effs- => P.Semantic (ToPandoc ': effs) a- -> P.Semantic (P.Writer PandocWithRequirements ': effs) a+ => P.Sem (ToPandoc ': effs) a+ -> P.Sem (P.Writer PandocWithRequirements ': effs) a toWriter = P.reinterpret $ \case (AddFrom rf ro x) -> P.raise (fmap justDoc $ toPandoc rf ro x) >>= P.tell @PandocWithRequirements@@ -234,8 +234,8 @@ -- | Run ToPandoc by interpreting in Writer and then running that Writer. runPandocWriter :: PM.PandocEffects effs- => P.Semantic (ToPandoc ': effs) ()- -> P.Semantic effs PandocWithRequirements+ => P.Sem (ToPandoc ': effs) ()+ -> P.Sem effs PandocWithRequirements runPandocWriter = fmap fst . P.runWriter . toWriter -- | Type-alias for use with the @Docs@ effect.@@ -246,15 +246,15 @@ :: P.Member Pandocs effs => T.Text -- ^ name for document -> PandocWithRequirements -- ^ document and union of all input requirements- -> P.Semantic effs ()+ -> P.Sem effs () newPandocPure = newDoc -- | Add the Pandoc stored in the writer-style ToPandoc effect to the named docs collection with the given name. newPandoc :: (PM.PandocEffects effs, P.Member Pandocs effs) => T.Text -- ^ name of document- -> P.Semantic (ToPandoc ': effs) ()- -> P.Semantic effs ()+ -> P.Sem (ToPandoc ': effs) ()+ -> P.Sem effs () newPandoc n l = fmap fst (P.runWriter $ toWriter l) >>= newPandocPure n -- | Given a write format and options, convert the NamedDoc to the requested format@@ -274,8 +274,8 @@ :: PM.PandocEffects effs => PandocWriteFormat a -- ^ format for Pandoc output -> PA.WriterOptions -- ^ options for the Pandoc Writer- -> P.Semantic (Pandocs ': effs) () -- ^ effects stack to be (partially) run to get documents- -> P.Semantic effs [NamedDoc a] -- ^ documents in requested format, within the effects monad+ -> P.Sem (Pandocs ': effs) () -- ^ effects stack to be (partially) run to get documents+ -> P.Sem effs [NamedDoc a] -- ^ documents in requested format, within the effects monad pandocsToNamed pwf pwo = (traverse (namedPandocFrom pwf pwo) =<<) . toNamedDocList @@ -284,7 +284,7 @@ :: PM.PandocEffects effs => PandocWriteFormat a -- ^ format for Pandoc output -> PA.WriterOptions -- ^ options for the Pandoc Writer- -> P.Semantic (ToPandoc ': effs) () -- ^ effects stack to be (partially) run to get document- -> P.Semantic effs a -- ^ document in requested format, within the effects monad+ -> P.Sem (ToPandoc ': effs) () -- ^ effects stack to be (partially) run to get document+ -> P.Sem effs a -- ^ document in requested format, within the effects monad fromPandocE pwf pwo = ((fromPandoc pwf pwo . fst) =<<) . P.runWriter . toWriter
src/Knit/Effect/PandocMonad.hs view
@@ -73,7 +73,7 @@ import qualified Knit.Effect.Logger as Log import qualified Polysemy as P-import qualified Polysemy.IO as P+--import qualified Polysemy.IO as P import Polysemy.Internal ( send ) import Polysemy.Internal.Combinators ( stateful ) import qualified Polysemy.Error as P@@ -149,11 +149,11 @@ LogOutput :: PA.LogMessage -> Pandoc m () Trace :: String -> Pandoc m () -P.makeSemantic ''Pandoc+P.makeSem ''Pandoc -- TODO: Understand the error pieces better. Some things are thrown in IO, not sure we catch those?? -- | Split off the error piece. We will handle directly with the polysemy @Error@ effect-instance (P.Member (P.Error PA.PandocError) effs) => MonadError PA.PandocError (P.Semantic effs) where+instance (P.Member (P.Error PA.PandocError) effs) => MonadError PA.PandocError (P.Sem effs) where throwError = P.throw catchError = P.catch @@ -167,9 +167,7 @@ -- | Handle the logging with the knit-haskell logging effect. logPandocMessage- :: P.Member (Log.Logger Log.LogEntry) effs- => PA.LogMessage- -> P.Semantic effs ()+ :: P.Member (Log.Logger Log.LogEntry) effs => PA.LogMessage -> P.Sem effs () logPandocMessage lm = send $ Log.Log $ Log.LogEntry (pandocSeverity lm) (T.pack . PA.showLogMessage $ lm)@@ -182,7 +180,7 @@ , P.Member (Log.Logger Log.LogEntry) effs) -- | PandocMonad instance so that pandoc functions can be run in the polysemy union effect-instance PandocEffects effs => PA.PandocMonad (P.Semantic effs) where+instance PandocEffects effs => PA.PandocMonad (P.Sem effs) where lookupEnv = lookupEnv getCurrentTime = getCurrentTime getCurrentTimeZone = getCurrentTimeZone@@ -215,13 +213,13 @@ , P.Member (P.Lift IO) effs , P.Member (P.Error PA.PandocError) effs )- => P.Semantic (Pandoc ': effs) a- -> P.Semantic effs a+ => P.Sem (Pandoc ': effs) a+ -> P.Sem effs a interpretInIO = fmap snd . stateful f PA.def where liftPair :: forall f x y . Functor f => (x, f y) -> f (x, y) liftPair (x, fy) = fmap (x, ) fy- f :: Pandoc m x -> PA.CommonState -> P.Semantic effs (PA.CommonState, x)+ f :: Pandoc m x -> PA.CommonState -> P.Sem effs (PA.CommonState, x) f (LookupEnv s) cs = liftPair (cs, liftIO $ IO.lookupEnv s) f GetCurrentTime cs = liftPair (cs, liftIO $ IO.getCurrentTime) f GetCurrentTimeZone cs = liftPair (cs, liftIO IO.getCurrentTimeZone)@@ -252,8 +250,8 @@ , P.Member (P.Lift m) effs , P.Member (Log.Logger Log.LogEntry) effs )- => P.Semantic (Pandoc ': effs) a- -> P.Semantic effs a+ => P.Sem (Pandoc ': effs) a+ -> P.Sem effs a interpretInPandocMonad = P.interpret (\case LookupEnv s -> P.sendM @m $ PA.lookupEnv s@@ -281,7 +279,7 @@ -- If there is a Pandoc error, you will get a Left in the resulting Either. runIO :: [Log.LogSeverity]- -> P.Semantic+ -> P.Sem '[Pandoc, Log.Logger Log.LogEntry, Log.PrefixLog, P.Error PA.PandocError, P.Lift IO] a@@ -298,9 +296,7 @@ ) => PA.CommonState -> String- -> P.Semantic- effs- (PA.CommonState, (BS.ByteString, Maybe PA.MimeType))+ -> P.Sem effs (PA.CommonState, (BS.ByteString, Maybe PA.MimeType)) openURLWithState cs u | Just u'' <- L.stripPrefix "data:" u = do let mime = L.takeWhile (/= ',') u''@@ -338,7 +334,7 @@ :: (P.Member (Log.Logger Log.LogEntry) effs) => PA.CommonState -> PA.LogMessage- -> P.Semantic effs PA.CommonState+ -> P.Sem effs PA.CommonState report cs msg = do let verbosity = PA.stVerbosity cs level = PA.messageVerbosity msg@@ -347,12 +343,12 @@ cs' = cs { PA.stLog = stLog' } return cs' --- | Utility function to lift IO errors into Semantic+-- | Utility function to lift IO errors into Sem liftIOError :: (P.Member (P.Error PA.PandocError) effs, P.Member (P.Lift IO) effs) => (String -> IO a) -> String- -> P.Semantic effs a+ -> P.Sem effs a liftIOError f u = do res <- liftIO $ IO.tryIOError $ f u case res of@@ -363,6 +359,7 @@ -- or maybe the actual version on each machine has a correct local version?? -- TODO: Fix/Understand this datadir :: FilePath+datadir = "/home/builder/hackage-server/build-cache/tmp-install/share/x86_64-linux-ghc-8.6.3/pandoc-2.7.2" getDataFileName' :: FilePath -> IO FilePath
src/Knit/Effect/RandomFu.hs view
@@ -62,26 +62,25 @@ GetRandomPrim :: R.Prim t -> Random m t -- | Convert a random-fu RVar to the Random Effect-sampleRVar :: (P.Member Random effs) => R.RVar t -> P.Semantic effs t+sampleRVar :: (P.Member Random effs) => R.RVar t -> P.Sem effs t sampleRVar = send . SampleRVar -- | Convert a random-fu Distribution to the Random Effect-sampleDist- :: (P.Member Random effs, R.Distribution d t) => d t -> P.Semantic effs t+sampleDist :: (P.Member Random effs, R.Distribution d t) => d t -> P.Sem effs t sampleDist = sampleRVar . R.rvar -getRandomPrim :: P.Member Random effs => R.Prim t -> P.Semantic effs t+getRandomPrim :: P.Member Random effs => R.Prim t -> P.Sem effs t getRandomPrim = send . GetRandomPrim -- | Run in IO using default random-fu IO source runRandomIOSimple :: forall effs a- . MonadIO (P.Semantic effs)- => P.Semantic (Random ': effs) a- -> P.Semantic effs a+ . MonadIO (P.Sem effs)+ => P.Sem (Random ': effs) a+ -> P.Sem effs a runRandomIOSimple = P.interpret f where- f :: forall m x . (Random m x -> P.Semantic effs x)+ f :: forall m x . (Random m x -> P.Sem effs x) f r = case r of SampleRVar rv -> liftIO $ R.sample rv GetRandomPrim pt -> liftIO $ R.getRandomPrim pt@@ -89,28 +88,28 @@ -- | Run using the given source runRandomFromSource :: forall s effs a- . R.RandomSource (P.Semantic effs) s+ . R.RandomSource (P.Sem effs) s => s- -> P.Semantic (Random ': effs) a- -> P.Semantic effs a+ -> P.Sem (Random ': effs) a+ -> P.Sem effs a runRandomFromSource source = P.interpret f where- f :: forall m x . (Random m x -> P.Semantic effs x)+ f :: forall m x . (Random m x -> P.Sem effs x) f r = case r of SampleRVar rv -> R.runRVar (R.sample rv) source GetRandomPrim pt -> R.runRVar (R.getRandomPrim pt) source -- | Run in 'IO', using the given 'PureMT' source stored in an 'IORef' runRandomIOPureMT- :: MonadIO (P.Semantic effs)+ :: MonadIO (P.Sem effs) => R.PureMT- -> P.Semantic (Random ': effs) a- -> P.Semantic effs a+ -> P.Sem (Random ': effs) a+ -> P.Sem effs a runRandomIOPureMT source re = liftIO (newIORef source) >>= flip runRandomFromSource re -- | supply instance of MonadRandom for functions which require it $(R.monadRandom [d|- instance P.Member Random effs => R.MonadRandom (P.Semantic effs) where+ instance P.Member Random effs => R.MonadRandom (P.Sem effs) where getRandomPrim = getRandomPrim |])
src/Knit/Report.hs view
@@ -58,13 +58,14 @@ -- * Effects , module Polysemy , module Knit.Effect.Pandoc+ , module Knit.Effect.Docs , module Knit.Effect.PandocMonad , module Knit.Effect.Logger ) where import Polysemy ( Member- , Semantic+ , Sem , Lift ) import Knit.Effect.Pandoc ( ToPandoc@@ -72,7 +73,9 @@ , PandocReadFormat(..) , PandocWriteFormat(..) , Pandocs+ , newPandoc )+import Knit.Effect.Docs ( NamedDoc(..) ) import Knit.Effect.PandocMonad import Knit.Effect.Logger ( LogSeverity(..) , logAll@@ -108,7 +111,6 @@ import Control.Monad.Except ( MonadIO ) import qualified Data.Text as T import qualified Data.Text.Lazy as TL-import GHC.Exts ( Constraint ) import qualified Polysemy as P import qualified Polysemy.Error as PE@@ -128,37 +130,39 @@ -- | Create multiple HTML docs (as Text) from the named sets of pandoc fragments. -- In use, you may need a type-application to specify m.--- This allows use of any underlying monad to handle the Pandoc effects. +-- This allows use of any underlying monad to handle the Pandoc effects.+-- NB: Resulting documents are *Lazy* Text, as produced by the Blaze render function. knitHtmls- :: forall m- . (MonadIO m, LastMember (P.Lift m) (KnitEffectStack m))+ :: MonadIO m => Maybe T.Text -- ^ outer logging prefix -> [KLog.LogSeverity] -- ^ what to output in log -> PandocWriterConfig -- ^ configuration for the Pandoc Html Writer- -> P.Semantic (KnitEffectDocsStack m) () -- ^ Knit effects "over" m- -> m (Either PA.PandocError [KP.NamedDoc TL.Text]) -- ^ named documents, converted to Html as Text or error+ -> P.Sem (KnitEffectDocsStack m) ()+ -> m (Either PA.PandocError [KP.NamedDoc TL.Text]) knitHtmls loggingPrefixM ls writeConfig =- runSemT (consumeKnitEffectMany loggingPrefixM ls writeConfig)+ consumeKnitEffectStack loggingPrefixM ls . KD.toNamedDocListWithM+ (fmap BH.renderHtml . KO.toBlazeDocument writeConfig) -- | Create HTML Text from pandoc fragments -- In use, you may need a type-application to specify m.--- This allows use of any underlying monad to handle the Pandoc effects. +-- This allows use of any underlying monad to handle the Pandoc effects.+-- NB: Resulting document is *Lazy* Text, as produced by the Blaze render function. knitHtml- :: forall m- . (MonadIO m, LastMember (P.Lift m) (KnitEffectStack m))+ :: MonadIO m => Maybe T.Text -- ^ outer logging prefix -> [KLog.LogSeverity] -- ^ what to output in log -> PandocWriterConfig -- ^ configuration for the Pandoc Html Writer- -> P.Semantic (KnitEffectDocStack m) () -- ^ Knit effects "over" m- -> m (Either PA.PandocError TL.Text) -- ^ document, converted to Html as Text, or error+ -> P.Sem (KnitEffectDocStack m) ()+ -> m (Either PA.PandocError TL.Text) knitHtml loggingPrefixM ls writeConfig =- runSemT (consumeKnitEffectOne loggingPrefixM ls writeConfig)+ fmap (fmap (fmap BH.renderHtml)) (consumeKnitEffectStack loggingPrefixM ls)+ . KO.pandocWriterToBlazeDocument writeConfig --- | Constraints required to build a document while also using effects from a base monad m.+-- | Constraints required to knit a document using effects from a base monad m. type KnitBase m effs = (MonadIO m, P.Member (P.Lift m) effs) --- | lift an action in a base monad into a Polysemy monad-liftKnit :: Member (Lift m) r => m a -> Semantic r a+-- | lift an action in a base monad into a Polysemy monad. This is just a renaming for convenience.+liftKnit :: Member (Lift m) r => m a -> Sem r a liftKnit = P.sendM -- From here down is unexported. @@ -172,90 +176,25 @@ , P.Lift IO , P.Lift m ]- -- | Add a Multi-doc writer to the front of the effect list type KnitEffectDocsStack m = (KD.Docs KP.PandocWithRequirements ': KnitEffectStack m) -- | Add a single-doc writer to the front of the effect list type KnitEffectDocStack m = (KP.ToPandoc ': KnitEffectStack m) --- | require that the effect @eff@ be last in the list of effects @r@-type family LastMember (eff :: k) (r :: [k]) :: Constraint where- LastMember eff '[] = ()- LastMember eff (e : es) = (P.Member eff (e ': es), LastMember eff es)---- | run all effects, given that last one is @Lift m@-runSemT- :: Monad m- => (P.Semantic r a -> P.Semantic '[P.Lift m] b)- -> P.Semantic r a- -> m b-runSemT consume = P.runM . consume---- | run all effects in @KnitEffectStack m@ except the final @Lift m@+-- | run all knit-effects in @KnitEffectStack m@ consumeKnitEffectStack :: forall m a- . (MonadIO m, LastMember (P.Lift m) (KnitEffectStack m))+ . MonadIO m => Maybe T.Text -- ^ outer logging prefix -> [KLog.LogSeverity] -- ^ what to output in log- -> P.Semantic (KnitEffectStack m) a- -> P.Semantic '[P.Lift m] (Either PA.PandocError a)+ -> P.Sem (KnitEffectStack m) a+ -> m (Either PA.PandocError a) consumeKnitEffectStack loggingPrefixM ls =- PI.runIO @m -- interpret (Lift IO) using m+ P.runM+ . PI.runIO @m -- interpret (Lift IO) using m . PE.runError . KLog.filteredLogEntriesToIO ls . KPM.interpretInIO -- PA.PandocIO . maybe id KLog.wrapPrefix loggingPrefixM --- | run all effects in @KnitEffectDocsStack m@ except the final @Lift m@-consumeKnitEffectMany- :: forall m- . (MonadIO m, LastMember (P.Lift m) (KnitEffectStack m))- => Maybe T.Text -- ^ outer logging prefix- -> [KLog.LogSeverity] -- ^ what to output in log- -> PandocWriterConfig -- ^ configuration for the Pandoc Html Writer- -> P.Semantic (KnitEffectDocsStack m) ()- -> P.Semantic- '[P.Lift m]- (Either PA.PandocError [KP.NamedDoc TL.Text])-consumeKnitEffectMany loggingPrefixM ls writeConfig =- consumeKnitEffectStack @m loggingPrefixM ls . KD.toNamedDocListWithM- (fmap BH.renderHtml . KO.toBlazeDocument writeConfig)---- | run all effects in @KnitEffectDocStack m@ except the final @Lift m@-consumeKnitEffectOne- :: forall m- . (MonadIO m, LastMember (P.Lift m) (KnitEffectStack m))- => Maybe T.Text -- ^ outer logging prefix- -> [KLog.LogSeverity] -- ^ what to output in log- -> PandocWriterConfig -- ^ configuration for the Pandoc Html Writer- -> P.Semantic (KnitEffectDocStack m) ()- -> P.Semantic '[P.Lift m] (Either PA.PandocError TL.Text)-consumeKnitEffectOne loggingPrefixM ls writeConfig =- fmap (fmap (fmap BH.renderHtml)) (consumeKnitEffectStack @m loggingPrefixM ls)- . KO.pandocWriterToBlazeDocument writeConfig---{--type KnitEffectC m r = (- P.Member KPM.Pandoc r- , KLog.LogWithPrefixesLE r- , P.Member (PE.Error PA.PandocError) r- , P.Member (P.Lift IO) r- , P.Member (P.Lift m) r- )--consumeKnitEffectPoly- :: forall m r a- . (PA.PandocMonad m, MonadIO m, KnitEffectC m r, LastMember (P.Lift m) r)- => Maybe T.Text -- ^ outer logging prefix- -> [KLog.LogSeverity] -- ^ what to output in log- -> P.Semantic r a- -> P.Semantic '[P.Lift m] (Either PA.PandocError a)-consumeKnitEffectPoly loggingPrefixM ls =- PI.runIO @m- . PE.runError- . KLog.filteredLogEntriesToIO ls- . KPM.runPandoc @m -- PA.PandocIO- . maybe id KLog.wrapPrefix loggingPrefixM--}
src/Knit/Report/Input/Html.hs view
@@ -49,12 +49,12 @@ addStrictTextHtml :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => T.Text- -> P.Semantic effs ()+ -> P.Sem effs () addStrictTextHtml = PE.addFrom PE.ReadHtml htmlReaderOptions -- | Add Lazy Text Html to current Pandoc addLazyTextHtml :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => LT.Text- -> P.Semantic effs ()+ -> P.Sem effs () addLazyTextHtml = addStrictTextHtml . LT.toStrict
src/Knit/Report/Input/Html/Blaze.hs view
@@ -17,18 +17,18 @@ ) where -import Knit.Report.Input.Html (addLazyTextHtml)+import Knit.Report.Input.Html ( addLazyTextHtml ) import qualified Text.Blaze.Html as BH import qualified Text.Blaze.Html.Renderer.Text as BH import qualified Polysemy as P-import qualified Knit.Effect.Pandoc as PE-import qualified Knit.Effect.PandocMonad as PM+import qualified Knit.Effect.Pandoc as PE+import qualified Knit.Effect.PandocMonad as PM -- | Add Blaze Html addBlaze :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => BH.Html- -> P.Semantic effs ()+ -> P.Sem effs () addBlaze = addLazyTextHtml . BH.renderHtml
src/Knit/Report/Input/Html/Lucid.hs view
@@ -17,16 +17,16 @@ ) where -import Knit.Report.Input.Html (addLazyTextHtml)+import Knit.Report.Input.Html ( addLazyTextHtml ) import qualified Lucid as LH import qualified Polysemy as P-import qualified Knit.Effect.Pandoc as PE-import qualified Knit.Effect.PandocMonad as PM+import qualified Knit.Effect.Pandoc as PE+import qualified Knit.Effect.PandocMonad as PM -- | Add Lucid Html addLucid :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => LH.Html ()- -> P.Semantic effs ()+ -> P.Sem effs () addLucid = addLazyTextHtml . LH.renderText
src/Knit/Report/Input/Latex.hs view
@@ -21,14 +21,14 @@ import qualified Text.Pandoc as PA import qualified Polysemy as P-import qualified Knit.Effect.Pandoc as PE-import qualified Knit.Effect.PandocMonad as PM+import qualified Knit.Effect.Pandoc as PE+import qualified Knit.Effect.PandocMonad as PM -- | Add LaTeX addLatex :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => T.Text- -> P.Semantic effs ()+ -> P.Sem effs () addLatex lText = do PE.require PE.LatexSupport PE.addFrom PE.ReadLaTeX PA.def lText
src/Knit/Report/Input/MarkDown/PandocMarkDown.hs view
@@ -54,13 +54,13 @@ :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => PA.ReaderOptions -> T.Text- -> P.Semantic effs ()+ -> P.Sem effs () addMarkDownWithOptions = PE.addFrom PE.ReadMarkDown -- | Add a Pandoc MarkDown fragment with default options addMarkDown :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => T.Text- -> P.Semantic effs ()+ -> P.Sem effs () addMarkDown = addMarkDownWithOptions markDownReaderOptions
src/Knit/Report/Input/Table/Colonnade.hs view
@@ -30,14 +30,10 @@ import qualified Colonnade as C import qualified Text.Blaze.Colonnade as BC import qualified Text.Blaze.Html as BH-import qualified Text.Blaze.Html.Renderer.Text as BH import qualified Text.Blaze.Html5.Attributes as BHA import Knit.Report.Input.Html.Blaze ( addBlaze )-import Knit.Report.Input.MarkDown.PandocMarkDown- ( addMarkDown ) import Data.Text ( Text )-import qualified Data.Text.Lazy as TL import qualified Polysemy as P import qualified Knit.Effect.Pandoc as PE import qualified Knit.Effect.PandocMonad as PM@@ -47,7 +43,7 @@ :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs, Foldable f) => C.Colonnade C.Headed a Text -- ^ How to encode data as columns -> f a -- ^ collection of data- -> P.Semantic effs ()+ -> P.Sem effs () addColonnadeTextTable colonnade rows = do let toCell t = BC.Cell (BHA.style "border: 1px solid black") (BH.toHtml t) -- styling here gets lost. But maybe I can fix? addBlaze $ BC.encodeCellTable@@ -61,7 +57,7 @@ => BH.Attribute -- ^ Attributes of <table> Html element, currently unused by knit-haskell -> C.Colonnade C.Headed a BH.Html -- ^ How to encode data as columns -> f a -- ^ collection of data- -> P.Semantic effs ()+ -> P.Sem effs () addColonnadeHtmlTable attr colonnade rows = addBlaze $ BC.encodeHtmlTable attr colonnade rows @@ -71,6 +67,6 @@ => BH.Attribute -- ^ Attributes of <table> Html element, currently unused by knit-haskell -> C.Colonnade C.Headed a BC.Cell -- ^ How to encode data as columns -> f a -- ^ collection of data- -> P.Semantic effs ()+ -> P.Sem effs () addColonnadeCellTable attr colonnade rows = addBlaze $ BC.encodeCellTable attr colonnade rows
src/Knit/Report/Input/Visualization/Hvega.hs view
@@ -44,7 +44,7 @@ :: (PM.PandocEffects effs, P.Member PE.ToPandoc effs) => T.Text -> GV.VegaLite- -> P.Semantic effs ()+ -> P.Sem effs () addHvega vizId vl = do PE.require PE.VegaSupport addBlaze $ placeVisualization vizId vl
src/Knit/Report/Output/Html.hs view
@@ -79,7 +79,7 @@ markDownTextToBlazeFragment :: PM.PandocEffects effs => T.Text -- ^ markDown Text- -> P.Semantic effs BH.Html+ -> P.Sem effs BH.Html markDownTextToBlazeFragment = PE.fromPandocE PE.WriteHtml5 htmlWriterOptions . PE.addFrom PE.ReadMarkDown markDownReaderOptions@@ -91,7 +91,7 @@ :: PM.PandocEffects effs => PandocWriterConfig -> PE.PandocWithRequirements -- ^ Document and union of input requirements - -> P.Semantic effs BH.Html+ -> P.Sem effs BH.Html toBlazeDocument writeConfig pdocWR = do writerOptions <- htmlFullDocWriterOptions (templateFP writeConfig) (templateVars writeConfig)@@ -102,8 +102,8 @@ pandocWriterToBlazeDocument :: PM.PandocEffects effs => PandocWriterConfig -- ^ Configuration info for the Pandoc writer- -> P.Semantic (PE.ToPandoc ': effs) () -- ^ Effects stack to run to get Pandoc- -> P.Semantic effs BH.Html -- ^ Blaze Html (in remaining effects)+ -> P.Sem (PE.ToPandoc ': effs) () -- ^ Effects stack to run to get Pandoc+ -> P.Sem effs BH.Html -- ^ Blaze Html (in remaining effects) pandocWriterToBlazeDocument writeConfig pw = PE.runPandocWriter pw >>= toBlazeDocument writeConfig