Questions tagged [yesod]

Yesod is a Haskell web framework for productive development of type-safe, RESTful, high performance web applications.

Yesod is a Haskell web framework for productive development of type-safe, RESTful, high performance web applications.

Yesod leverages Haskell's type system to turn runtime bugs into compule-time errors, for example to avoid XSS attacks or character encoding issues. Yesod contains several DSLs for templating ( for HTML, for Javascript, and or for CSS), to store data (Persistent), for routing, etc.

1334 questions
8
votes
0 answers

yesod devel compiles after change, but doesn't actually reflect change

This happens in all handlers, but as an example, I have a simple handler I edit in vim: getListingR :: Handler Html getListingR = do defaultLayout $ do setTitle "Thing" [whamlet|

Content|] yesod devel launches a server, and sometimes…

cschneid
  • 460
  • 4
  • 10
8
votes
1 answer

Haskell small CPU leak

I’m experiencing small CPU leaks using GHC 7.8.3 and Yesod 1.4.9. When I run my site with time and stop it (Ctrl+C) after 1 minute without doing anything (just run, no request at all), it consumes 1 second. It represents approximately 1.7% of CPU. $…
zigazou
  • 1,725
  • 9
  • 13
8
votes
2 answers

How to store an Enum ADT in Persistent

How do you store an enum in Persistent? Say you have a data State = Ready | Unready | Error How do you store this in a Persistent database?
8
votes
2 answers

Best practice for validating JSON requests with Yesod

I am writing JSON RESTFul service with Yesod and need to implement requests validation. I cannot use Yesod.Form for it because of the service accepts JSON. I like the way scalaz validation uses but I didn't find any approach like this in Haskell. Is…
Andrey Kuznetsov
  • 11,640
  • 9
  • 47
  • 70
8
votes
1 answer

Yesod Sessionless Authentication

I am using Yesod to build a purely REST backend for an Angular based application. This application will be hosted separately with a CDN and will need to connect to the Yesod api as well as a few others. Is there a way to have Yesod accept a Bearer…
8
votes
1 answer

How to do store algebraic data type in persistent

For a data type like so data Tree = Node String Tree Tree | Leaf String And real data like so my_tree = (Node "first node" (Leaf "leaf") (Node "second node" (Leaf "leaf") (Leaf "leaf"))) How do I store that into database using…
HHC
  • 2,513
  • 2
  • 18
  • 26
8
votes
2 answers

How to send JSON between Elm Client and Haskell (Yesod) server

I'm trying to get basic JSON communication from client to server going, with the following Elm code: import open Http result res = case res of Success a -> a Waiting -> "Waiting" Failure n a-> "Failure " ++ (show n) ++ " " ++ (show…
jmite
  • 8,171
  • 6
  • 40
  • 81
8
votes
2 answers

Long polling in Yesod

Can I do long polling in Yesod, or any other Haskell web framework with comparable database facilities? To be precise, I want to delay a HTTP response until something interesting happens. There should also be a timeout after which the client will…
Adrian May
  • 2,127
  • 15
  • 24
8
votes
2 answers

What's the best way to do many-to-many in Persistent Yesod?

So my /config/models looks like this. Person name Text Car name Text PersonCar personId PersionId eq carId CarId eq UniquePersonCar personId carId Assume the inputs in the database are Person "Batman" Person "Superman" Car "SUV" Car…
HHC
  • 2,513
  • 2
  • 18
  • 26
8
votes
2 answers

Keep incorrect user input after POST/Redirect/GET using yesod-form

Recently I stumbled across the following problem: Using yesod I wanted to Display an applicative form and let the user POST his data to a special Handler On FormFailure redirect the browser to the previous page Print the error messages ... ... and…
Jakub
  • 507
  • 4
  • 14
8
votes
3 answers

Yesod, WebSockets and Persistent

I'm trying to implement a server for a turn based game in Haskell. My choice would be to use Yesod for adminstration and meta-information (like, what games a user participates in and such). I'd like to use web sockets to keep the in-game data…
Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
8
votes
1 answer

Yesod, howto generate type-safe link from JSON-data in Javascript / Julius

I've a route /notes/#NoteId NoteR GET From another page, I want to link to it. When using "classic" hamlet, it's easy: notetitle I want my page to be more dynamic and get JSON-data which contains the…
davidbe
  • 840
  • 1
  • 6
  • 16
7
votes
4 answers

Why aren't Persistent types instances of ToJSON/FromJSON in Yesod?

It's not that hard to write ToJSON/FromJSON instances for the generated types but still, while you're generating code could you throw that in? Or is there an easy way to make this happen as a Yesod user? (I haven't dug too deep into how TH…
svachalek
  • 1,166
  • 8
  • 18
7
votes
2 answers

Charting solutions for Yesod

Currently I am using hs-gchart do build charts to embed charts in my web application. I have seen that tkyprof uses d3.js. What other charting solutions are being used with yesod? What are the pros and cons of these solutions?
Steve Severance
  • 6,611
  • 1
  • 33
  • 44
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