Questions tagged [haskell-lucid]

The tag addresses the lucid-language to write HTML in Haskell.

Lucid is a haskell-based domain specific language to write HTML. Example usage:

λ> table_ (tr_ (td_ (p_ "Hello, World!"))) :: Html ()

generates the output:

<table><tr><td><p>Hello, World!</p></td></tr></table>
10 questions
3
votes
1 answer

How to serve static files using Spock and Lucid?

Getting started with web development using Haskell, Spock, and Lucid, I can't figure out how to serve my static files. In the directory of Main.hs I have /static/css/main.css, which contains just a background colour to see if the css is indeed…
Abby
  • 1,610
  • 3
  • 19
  • 35
2
votes
1 answer

Navigating Haskell Servant API with Lucid WebUI

I've learnt that I can define my API with servant and Lucid in the following way: type ClientAPI = "users" :> Get '[HTML] (Html ()) :<|> "userdata" :> Get '[HTML] (Html ()) Then if I want to add a link to one of the endpoints in my HTML,…
LA.27
  • 1,888
  • 19
  • 35
2
votes
1 answer

The true meaning of Lucid's "Term" type

I've been playing with Haskell, trying to create a very simple website using Servant and Lucid. At the moment I reached the stage "My code works, I have no idea why". I tried creating Bootstrap button. According the the doc, it should be defined…
LA.27
  • 1,888
  • 19
  • 35
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

Using Lucid for Simple Example

Given: import Lucid import Lucid.Base mainPage :: Html () mainPage = div_ (p_ "hello") I get the following compile-time error: /Users/kevinmeredith/Workspace/my-project/src/Lib.hs:9:18: error: • Couldn't match type ‘HtmlT…
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
1
vote
1 answer

Run Reader wrapped in HtmlT, producing Html ()

I'm using Lucid to generate code for a static site, writing code in the HtmlT (Reader MyEnv) monad to transparently pass around some configuration stored in MyEnv. The framework I'm using encapsulates the transformation from Html () to file output,…
mcwitt
  • 1,054
  • 1
  • 11
  • 10
1
vote
1 answer

How to stack correctly monads to finally render to html?

My goal is to feed correctly the html function (as define in Spock-core) with a HtmlT m type (ideally Html ()). In between I am performing some Network.Http.Simple requests. Apparently my knowledge of Haskell is insufficient, I didn't find the way…
user3680029
  • 179
  • 8
0
votes
1 answer

Cannot display IO [[String]] in app created in Spock and Lucid

I have an issue with Spock, Lucid and IO in Haskell. I've got a function f :: MySQLConn -> IO [[String]] Output of f is result of statement "SELECT * FROM TABLE" with converted [MySQLValue] lists to [String] lists. Then I want to use function f in…
grohub
  • 3
  • 2
0
votes
1 answer

Lucid nav element gives error about attribute list

I am currently in the process of rewriting an HTML file in Lucid for use with a Spock web server. However, for some reason this particular snippet gives me an error: sidebar :: Html () sidebar = do nav_ [id_ "sidebar"] $ do div [class_…
Zyphicx
  • 299
  • 2
  • 13
0
votes
1 answer

How to embed arbitrary dynamic HTML String into Haskell's Lucid Html type?

How can I parse an html string for example

Test

and have this be converted to value that would be similar to p_ "Test"? So the function type would be String -> Html (). I've found the following project…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286