knit-haskell-0.2.0.0: a minimal Rmarkdown sort-of-thing for haskell, by way of Pandoc

Copyright(c) Adam Conner-Sax 2019
LicenseBSD-3-Clause
Maintaineradam_conner_sax@yahoo.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Knit.Effect.Html

Contents

Description

Create a Lucid or Blaze html document (using a Writer to intersperse html and other code) and then use the Docs polysemy effect to store that document for processing/output later.

Synopsis

Lucid

Effects

type Lucid = Writer (Html ()) Source #

Type-Alias for a single Lucid document writer.

type LucidDocs = Docs (Html ()) Source #

Type-Alias for the Docs effect (multi-document Writer), specialized to Lucid docs. To be used in an app that produces multiple html outputs, built up from Lucid bits.

Actions

lucid :: Member Lucid effs => Html () -> Sem effs () Source #

Add a Lucid html fragment to the current Lucid doc.

Intepretations

lucidToNamedText :: Sem (LucidDocs ': effs) () -> Sem effs [NamedDoc Text] Source #

Interpret the LucidDocs effect (via Writer), producing a list of named Lucid docs, suitable for writing to disk.

lucidHtml :: Sem (Lucid ': effs) () -> Sem effs (Html ()) Source #

Interprest the Lucid effect (via Writer), producing a Lucid Html () from the currently written doc

lucidToText :: Sem (Lucid ': effs) () -> Sem effs Text Source #

Interpret the Lucid effect (via Writer), producing Text from the currently written doc

newLucidDoc :: Member LucidDocs effs => Text -> Sem (Lucid ': effs) () -> Sem effs () Source #

Take the current Lucid HTML in the writer and add it to the set of named docs with the given name. NB: Only use this function for making sets of documents built exclusively from Lucid. Otherwise use the more general Pandoc infrastructure in Pandoc.

Blaze

Effects

type Blaze = Writer Html Source #

Type-Alias for a single Blaze document writer.

type BlazeDocs = Docs Html Source #

Type-Alias for the Docs effect (multi-document Writer) specialized to Blaze docs. To be used in an app that produces multiple html outputs, built up from Blaze bits.

Actions

blaze :: Member Blaze effs => Html -> Sem effs () Source #

Add a Blaze html fragment to the current Blaze doc.

Interpretations

blazeToNamedText :: Sem (BlazeDocs ': effs) () -> Sem effs [NamedDoc Text] Source #

Interpret the BlazeDocs effect (via Writer), producing a list of named Blaze docs.

blazeHtml :: Sem (Blaze ': effs) () -> Sem effs Html Source #

Interpret the Blaze effect (via Writer), producing a Blaze Html from the currently written doc.

blazeToText :: Sem (Blaze ': effs) () -> Sem effs Text Source #

Interpret the Blaze effect (via Writer), producing Text from the currently written doc.

newBlazeDoc :: Member BlazeDocs effs => Text -> Sem (Blaze ': effs) () -> Sem effs () Source #

take the current Blaze HTML in the writer and add it to the set of named docs with the given name NB: Only use this function for making sets of documents built exclusively from Blaze. Otherwise use the more general Pandoc infrastructure in Pandoc.

Re-exports

data NamedDoc a Source #

Data type to hold one named document of type a.

Constructors

NamedDoc 

Fields

Instances
Functor NamedDoc Source # 
Instance details

Defined in Knit.Effect.Docs

Methods

fmap :: (a -> b) -> NamedDoc a -> NamedDoc b #

(<$) :: a -> NamedDoc b -> NamedDoc a #

Foldable NamedDoc Source # 
Instance details

Defined in Knit.Effect.Docs

Methods

fold :: Monoid m => NamedDoc m -> m #

foldMap :: Monoid m => (a -> m) -> NamedDoc a -> m #

foldr :: (a -> b -> b) -> b -> NamedDoc a -> b #

foldr' :: (a -> b -> b) -> b -> NamedDoc a -> b #

foldl :: (b -> a -> b) -> b -> NamedDoc a -> b #

foldl' :: (b -> a -> b) -> b -> NamedDoc a -> b #

foldr1 :: (a -> a -> a) -> NamedDoc a -> a #

foldl1 :: (a -> a -> a) -> NamedDoc a -> a #

toList :: NamedDoc a -> [a] #

null :: NamedDoc a -> Bool #

length :: NamedDoc a -> Int #

elem :: Eq a => a -> NamedDoc a -> Bool #

maximum :: Ord a => NamedDoc a -> a #

minimum :: Ord a => NamedDoc a -> a #

sum :: Num a => NamedDoc a -> a #

product :: Num a => NamedDoc a -> a #

Traversable NamedDoc Source # 
Instance details

Defined in Knit.Effect.Docs

Methods

traverse :: Applicative f => (a -> f b) -> NamedDoc a -> f (NamedDoc b) #

sequenceA :: Applicative f => NamedDoc (f a) -> f (NamedDoc a) #

mapM :: Monad m => (a -> m b) -> NamedDoc a -> m (NamedDoc b) #

sequence :: Monad m => NamedDoc (m a) -> m (NamedDoc a) #