Questions tagged [hamlet]

Hamlet is a type-safe framework for generating HTML code from Haskell

Hamlet is a type-safe tool for generating HTML code in Haskell. It is used in the Yesod web framework .

86 questions
12
votes
1 answer

What is the comment syntax in Yesod (hamlet) templates?

I just can not find how to comment line in hamlet template. Is there some syntax for comments? Like --

Some code should be ignored by template or something?

s9gf4ult
  • 862
  • 6
  • 20
11
votes
2 answers

Using Hamlet in Haskell without Yesod

Can anyone point me to an example of how to use Hamlet without Yesod? http://www.yesodweb.com/book/templates is a great bit of documentation, but I can't get my ghci session to render even a simple hamlet template without crashing.
singpolyma
  • 10,999
  • 5
  • 47
  • 71
9
votes
3 answers

compile-time vs. run-time cost of Hamlet templates

For the Hamlet template mechanism, I understand that the template is parsed at compile time, resulting in source code that contains calls to blaze-html combinators (and possibly other expressions because of interpolation). So the points (subtrees)…
d8d0d65b3f7cf42
  • 2,597
  • 15
  • 28
7
votes
1 answer

GHC cabal install hamlet fails with an obscure error

I am trying to install a Hamlet on a webfaction shared server so I can compile and run my web application there. I am using Yesod to develop the application. I managed to compile GHC 7 from source and bootstrapped cabal install. Next I did cabal…
Anupam Jain
  • 7,851
  • 2
  • 39
  • 74
6
votes
1 answer

How to print comma-separated list with hamlet?

With the hamlet templating language that comes with yesod, what is the best way of printing a comma-separated list? E.g. assume this code which just prints one entry after another, how do I insert commas in between the elements? Or maybe even add an…
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
5
votes
2 answers

Hamlet automatic access to variables in scope

From the Yesod Book. Hamlet automatically has access to the variables in scope when it's called. There is no need to specifically pass variables in. What is this deep magic? How can it automagically know what variables are in scope?
Dan Burton
  • 53,238
  • 27
  • 117
  • 198
5
votes
1 answer

Trouble with $forall in hamlet template

I'm having a strange issue with hamlet. I'm trying to use $forall to iterate through a list, but I keep getting a "Not in scope" error. I'm running yesod 0.9.2.2 on Win7. Terrible design aside, anyone have any idea where I'm going wrong? Removing…
Caleb
  • 224
  • 1
  • 2
  • 7
5
votes
4 answers

Load different JS library files for different components

I have a website made in ReactJS. In public/index.html, I have
where analyzejs-v1.js has 6Mo, and…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
5
votes
1 answer

How to import Shakespearean Templates in Yesod?

I was using QuasiQuotations in Yesod, and everything worked fine. BUT my file became very large and not nice to look at. Also, my TextEditor does not highlight this syntax correctly. That is why is split my files like so: getHomeR :: Handler…
Divide by Zero
  • 1,343
  • 1
  • 14
  • 37
5
votes
1 answer

How to avoid whitespace after a tag (link) in Hamlet templates?

I cannot find a way to render a link and then comma or full stop right after it, without whitespace between the link and punctuation. Here is my initial attempt:

You can find more information # here \. or

You…

Mark Karpov
  • 7,499
  • 2
  • 27
  • 62
5
votes
0 answers

Yesod: how do you interpolate a route with a path piece?

If I have a route such as /foo/#String FooR GET POST How do I interpolate this path in a hamlet file (say, to post to?) The following don't work:
MitchellSalad
  • 4,171
  • 8
  • 23
  • 24
5
votes
1 answer

Is there a function that transform from plain HTML to Hamlet structure?

I am starting to use the Yesod web framework. I have some already existing template HTML code that I would like to automatically translate to a Hamlet code structure. Is there a way to do this?
Invoke
  • 215
  • 1
  • 10
4
votes
3 answers

Haskell Yesod problems

someone could help me?! I'm working in a Haskell Yesod site for college on a C9 workspace, I've already installed by command Yesod and update cabal, but when I try "stack build" command, this miserable error message appears: $ stack…
Flavia
  • 41
  • 3
4
votes
1 answer

How to add conditional comments to hamlet templates?

How can I add conditional comments (or any kind of Html comment) to Shakespearean templates? If I add to my hamlet template just an empty line is…
Stephan Kulla
  • 4,739
  • 3
  • 26
  • 35
4
votes
1 answer

Rendering static HTML with hamlet

How can I use the hamlet framework to generate static HTML pages from inside Haskell? Note: This question intentionally doesn't show research effort. For my research effort, see the Q&A-style answer below.
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
1
2 3 4 5 6