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
14
votes
3 answers

yesod - getting the request body for a POST "Content-type: application/json"

Using yesod 0.8.0, I'm trying to retrieve the body of a post message from this example request: curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"name":"oscar"}' http://localhost:3000/user/xyz in my handler…
Oscar
  • 141
  • 1
  • 3
14
votes
1 answer

How to build an AngularJS app with Yesod

I managed to successfully write a small app using Yesod. Now I am in the phase in which I want to add better interaction to it, and I would like to do this using AngularJS. As far as I can see, the support for AngularJS in Yesod is still…
Damian Nadales
  • 4,907
  • 1
  • 21
  • 34
14
votes
1 answer

Allowing cross-origin requests in Yesod

My application uses a bookmarklet, and I need to allow CORS for MyRouteR so my bookmarklet code can use this route for AJAX requests. In my first draft of config/routes I gave MyRouteR support for only one request method, PUT. But it turned out…
Christian Brink
  • 663
  • 4
  • 18
14
votes
1 answer

Does yesod uses the processor when idle?

I have created a very simple application using yesod. It's not very used, but when I check with htop, it has consumed more cpu time than all other processes in the server, including processes that are running for a much bigger time. Also, when I…
marcot
  • 321
  • 2
  • 8
13
votes
1 answer

cabal install ... failing - osx - many unsatisfied packages

Update: Running ghc-pkg check reported: ~: ghc-pkg check WARNING: cache is out of date: /Library/Frameworks/GHC.framework/Versions/7.0.3i386/usr/lib/ghc-7.0.3/package.conf.d/package.cache use 'ghc-pkg recache' to fix. ~: ghc-pkg recache and after…
ErikR
  • 51,541
  • 9
  • 73
  • 124
13
votes
2 answers

I don't understand what this type family stuff in yesod is for

I went through yesod book and the source and learned pretty much how everything works. But before I write my own stuff, there is one thing in the scaffolded site that I just don't understand. So I scaffold a site "copywww" and in the file…
David McHealy
  • 2,471
  • 18
  • 34
13
votes
1 answer

Representing sum types in sql with Persistent, and Esqueleto joins

I have been trying to figure out a sensible way to represent Haskell sum types in a SQL backend using persistent. My target Haskell data type is along the lines of data Widget = FooWidget Int | BarWidget T.Text data HElement = HElement { name …
Michael Thomas
  • 1,354
  • 7
  • 18
13
votes
1 answer

Is there a way to kill all forked threads in a GHCi session without restarting it?

Based on my previous question I'd like to ask if there's any way to kill all user created threads in a GHCi session? The reason for this is that when a function exits in GHCi the threads that it spawned don't terminate automatically, persisting even…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
13
votes
2 answers

How do I define a composite key in Persistent

How do I declare to Persistent that I have a table the primary key of which is a combination of two fields? For example, assume I have a table containing first_name and last_name, then in SQL syntax I'll need something like: CONSTRAINT pk_PersonID…
Uri Barenholz
  • 693
  • 3
  • 13
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
12
votes
2 answers

Composing Database.Esqueleto queries, conditional joins and counting

How can I compose Database.Esqueleto queries in a modular way such that after defining a "base" query and the corresponding result set, I can restrict the result set by adding additional inner joins and where expressions. Also, how can I convert the…
Tero
  • 185
  • 6
12
votes
1 answer

Example of persistent with backend-specific operator

I would like to do a LIKE query in persistent, I'm using sqlite. The yesod book gives an example of using raw SQL to do it, but says: you can express a LIKE operator directly in the normal syntax due to a feature added in Persistent 0.6, which…
JP Moresmau
  • 7,388
  • 17
  • 31
12
votes
1 answer

Efficient large file upload with Yesod

I want to implement large file upload with my Yesod application. Right now I have: module Handler.File where import Import import System.Random import System.FilePath import Control.Monad import qualified Data.ByteString.Lazy as LBS import…
Tener
  • 5,280
  • 4
  • 25
  • 44
11
votes
2 answers

How to use UTCTime in yesod without hidden module errors?

I'm creating a simple website using yesod. It was working until I added a field of type UTCTime to my database model. I initially got an error suggesting I add "time-1.2.0.3" to my cabal file, so I did and now I get much the same error without the…
arx
  • 16,686
  • 2
  • 44
  • 61
11
votes
1 answer

Link to a static file from Hamlet

I'm currently experimenting with Yesod by following the tutorial on the Yesod Wiki. First I created a yesod application using yesod init, and created a Root handler that renders a widget file called homepage: getRootR = do mu <-…
Antoine
  • 5,158
  • 1
  • 24
  • 37
1
2
3
88 89