Questions tagged [blaze-html]

BlazeHtml is a fast HTML combinator library for Haskell. It allows the embeds of HTML templates in Haskell code aiming for optimal efficiency and composability.

BlazeHtml is a fast HTML combinator library for Haskell. It allows the embeds of HTML templates in Haskell code aiming for optimal efficiency and composability (source).

28 questions
5
votes
2 answers

Is there a less awkward way to use blaze-html with a Reader monad?

The BlazeHtml tutorial suggests using a Reader monad for real-world templating with BlazeHtml, but without illustrating how this should be done. I tried following this recommendation. The result leaves me confused. To illustrate, assume I have a…
dan
  • 43,914
  • 47
  • 153
  • 254
5
votes
1 answer

Escaping ampersands in Blaze Html

I want to put an HTML entity (in particular, ©) into my document. However if I type it and feed it as a Text straight into a blaze combinator, the ampersand is html-escaped and comes out as literally © -- or rather, the HTML outputted is…
Justin L.
  • 13,510
  • 5
  • 48
  • 83
4
votes
1 answer

Commenting hsx blaze-html lines in Haskell

I'm starting to experiment with IHP's webframework. I am testing some different page layouts and I can't seem to find the right way of commenting out html within the hsx QuasiQuote (which has the blaze-html syntax) whilst experimenting with the…
Montmorency
  • 412
  • 3
  • 11
4
votes
2 answers

Can't intersperse " " and unwords be used as drop in replacements for each other?

I was trying to rewrite: return $ renderHtml $ mconcat $ intersperse " " $ catMaybes links Which works just fine, into: return $ renderHtml $ mconcat $ unwords $ catMaybes links but it is returning: Couldn't match type ‘Char’ with…
Berkson
  • 65
  • 4
4
votes
0 answers

Text.Html vs Blaze.Html

I'm a bit confused which Haskell Html library to use. People tend to recommend the use of libraries available available in the Haskell platform (which is the case of Text.Html), however everybody seems to use Blaze.Html. What is the difference…
mb14
  • 22,276
  • 7
  • 60
  • 102
3
votes
1 answer

Iterating over lists in Haskell do block?

I apologize for the bad title, but I don't quite know how to summarize this. I'm a Haskell beginner, making a website in Haskell (Hakyll) using templates in Blaze-HTML, which uses do notation to make HTML. Here's part of my template:…
Jonathan
  • 10,571
  • 13
  • 67
  • 103
3
votes
0 answers

Perform a wildcard module import on a directory?

If I have a bunch of modules in a directory called Views, I'd like to import them all with import Views.*. Instead, as far as I can tell the current haskell idiom is to create a file Views.hs that imports all those files. My use case: I'm building a…
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
2
votes
2 answers

I would like to add Lucid into Yesod's defaultLayout

I am trying to have a dynamic HTML id for modals usage. Basically my problems would be solved if Hamlet accepted something like [hamlet|
|] Since I haven't been able to do that in Hamlet, I am trying to do…
hhefesto
  • 331
  • 1
  • 11
2
votes
2 answers

How to render blaze-svg markup within blaze-html

I want to include a svg diagram generated with blaze-svg directly in html generated with blaze-html. Both are based on blaze-markup, so I expected it to be easy. diagram1 :: Svg diagram1 = ... try1 :: Html try1 = html $ body $ do h1 "My…
Mikkel
  • 762
  • 5
  • 17
2
votes
1 answer

how to get html from blaze -- print to file

I am working through the blaze-html tutorial. I just want a simple Hello World page. {-# LANGUAGE OverloadedStrings #-} import Control.Monad (forM_) import Text.Blaze.Html5 import Text.Blaze.Html5.Attributes import qualified Text.Blaze.Html5 as…
john mangual
  • 7,718
  • 13
  • 56
  • 95
2
votes
1 answer

Blaze-html class attribute chaining / appending / concatenation?

I've been working on some quickly-growing Haskell based web applications, and am finding myself shot in the foot with this issue. Suppose I have some template that I've defined early in my code: {-# LANGUAGE OverloadedStrings #-} import…
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
2
votes
1 answer