Render the HTML to a lazy Text.
This is a convenience function defined in terms of execHtmlT, runIdentity and toLazyByteString, and decodeUtf8. Check the source if you're interested in the lower-level behaviour.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulelucid-2.11.20230408Haskell2010
Base types and combinators.
Render the HTML to a lazy Text.
This is a convenience function defined in terms of execHtmlT, runIdentity and toLazyByteString, and decodeUtf8. Check the source if you're interested in the lower-level behaviour.
Render the HTML to a lazy ByteString.
This is a convenience function defined in terms of execHtmlT, runIdentity and toLazyByteString. Check the source if you're interested in the lower-level behaviour.
Render the HTML to a lazy Text, but in a monad.
This is a convenience function defined in terms of execHtmlT and toLazyByteString, and decodeUtf8. Check the source if you're interested in the lower-level behaviour.
Render the HTML to a lazy ByteString, but in a monad.
This is a convenience function defined in terms of execHtmlT and toLazyByteString. Check the source if you're interested in the lower-level behaviour.
Render the HTML to a lazy ByteString.
This is a convenience function defined in terms of execHtmlT, runIdentity and toLazyByteString. Check the source if you're interested in the lower-level behaviour.
Build the HTML. Analogous to execState.
You might want to use this is if you want to do something with the raw Builder. Otherwise for simple cases you can just use renderText or renderBS.
evalHtmlT Evaluate the HTML to its return value. Analogous to evalState.
Use this if you want to ignore the HTML output of an action completely and just get the result.
For using with the Html type, you'll need runIdentity e.g.
runIdentity (evalHtmlT (p_ "Hello!"))()
relaxHtmlT commuteHtmlT Commute inner m to the front.
This is useful when you have impure HTML generation, e.g. using StateT.
Recall, there is `MonadState s HtmlT` instance.
exampleHtml :: MonadState Int m => HtmlT m ()
exampleHtml = ul_ $ replicateM_ 5 $ do
x <- get
put (x + 1)
li_ $ toHtml $ show x
exampleHtml' :: Monad m => HtmlT m ()
exampleHtml' = evalState (commuteHtmlT exampleHtml) 1
Make an HTML builder.
Make an HTML builder for elements which have no ending tag.
Make an XML builder for elements which have no ending tag.
Make an attribute builder.
A monad transformer that generates HTML. Use the simpler Html type if you don't want to transform over some other monad.
Don't rely on the internal representation of this type. Use the monad and functor classes.
MonadTrans HtmlTDefined in lucid-2.11.20230408 · Lucid.BaseUsed for lift.
MFunctor HtmlTDefined in lucid-2.11.20230408 · Lucid.BaseMonadError e m => MonadError e (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseMonadReader r m => MonadReader r (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseMonadState s m => MonadState s (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseMonadWriter w m => MonadWriter w (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.Base(Monad m, a ~ ()) => TermRaw Text (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven children immediately, just use that and expect no attributes.
Monad m => Monad (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseBasically acts like Writer.
Functor m => Functor (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseJust re-uses Monad.
MonadFix m => MonadFix (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseApplicative m => Applicative (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseBased on the monad instance.
MonadIO m => MonadIO (HtmlT m)Defined in lucid-2.11.20230408 · Lucid.BaseIf you want to use IO in your HTML generation.
(Applicative m, f ~ HtmlT m a) => Term [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
(Monad m, ToHtml f, a ~ ()) => TermRaw [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
m ~ Identity => Show (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseJust calls renderText.
(Monad m, a ~ ()) => IsString (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseWe pack it via string. Could possibly encode straight into a builder. That might be faster.
(a ~ (), Applicative m) => Semigroup (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.Base(a ~ (), Applicative m) => Monoid (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseMonoid is right-associative, a la the Builder in it.
(a ~ (), m ~ Identity) => ToHtml (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseFunctor m => With (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseFor the contentless elements: br_
Functor m => With (HtmlT m a -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseFor the contentful elements: div_
Applicative m => Term (HtmlT m a) (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven children immediately, just use that and expect no attributes.
A simple attribute. Don't use the constructor, use makeAttribute. Attributes are case sensitive, so if you want attributes to be merged properly, use a single case representation.
Eq AttributeDefined in lucid-2.11.20230408 · Lucid.BaseShow AttributeDefined in lucid-2.11.20230408 · Lucid.BaseHashable AttributeDefined in lucid-2.11.20230408 · Lucid.BaseTerm Text AttributeDefined in lucid-2.11.20230408 · Lucid.BaseTermRaw Text AttributeDefined in lucid-2.11.20230408 · Lucid.Base(Applicative m, f ~ HtmlT m a) => Term [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
(Monad m, ToHtml f, a ~ ()) => TermRaw [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
Used to construct HTML terms.
Simplest use: p_ = term "p" yields p_.
Very overloaded for three cases:
The first case is the basic arg of [(Text,Text)] which will
return a function that wants children.
The second is an arg which is HtmlT m (), in which case the
term accepts no attributes and just the children are used for the
element.
Finally, this is also used for overloaded attributes, like
style_ or title_. If a return type of (Text,Text) is inferred
then an attribute will be made.
The instances look intimidating but actually the constraints make
it very general so that type inference works well even in the
presence of things like OverloadedLists and such.
Term Text AttributeDefined in lucid-2.11.20230408 · Lucid.Base(Applicative m, f ~ HtmlT m a) => Term [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
Applicative m => Term (HtmlT m a) (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven children immediately, just use that and expect no attributes.
TermRaw Text AttributeDefined in lucid-2.11.20230408 · Lucid.Base(Monad m, a ~ ()) => TermRaw Text (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven children immediately, just use that and expect no attributes.
(Monad m, ToHtml f, a ~ ()) => TermRaw [Attribute] (f -> HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseGiven attributes, expect more child input.
Can be converted to HTML.
ToHtml ByteStringDefined in lucid-2.11.20230408 · Lucid.BaseToHtml ByteStringDefined in lucid-2.11.20230408 · Lucid.BaseToHtml StringDefined in lucid-2.11.20230408 · Lucid.BaseToHtml TextDefined in lucid-2.11.20230408 · Lucid.BaseToHtml TextDefined in lucid-2.11.20230408 · Lucid.Base(a ~ (), m ~ Identity) => ToHtml (HtmlT m a)Defined in lucid-2.11.20230408 · Lucid.BaseWith an element use these attributes. An overloaded way of adding attributes either to an element accepting attributes-and-children or one that just accepts attributes. See the two instances.