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
234
votes
4 answers

Comparing Haskell's Snap and Yesod web frameworks

The two Haskell web frameworks in the news recently are Yesod (at 0.8) and Snap (at 0.4). It's quite obvious that Yesod currently supports a lot more features than Snap. However, I can't stand the syntax Yesod uses for its HTML, CSS and Javascript.…
Muchin
  • 4,887
  • 4
  • 23
  • 25
93
votes
1 answer

Exceptions in Yesod

I had made a daemon that used a very primitive form of ipc (telnet and send a String that had certain words in a certain order). I snapped out of it and am now using JSON to pass messages to a Yesod server. However, there were some things I really…
user1198582
85
votes
1 answer

How can I get esqueleto to generate an SQL string for me?

How can I get esqueleto to generate an SQL string from a from statement? The documentation of toRawSql says that "you may just turn on query logging of persistent". I tried all possible forms of MonadLogger that I could understand, but it never…
Tom Ellis
  • 9,224
  • 1
  • 29
  • 54
47
votes
1 answer

Multiple Auth in Yesod?

I need to require multiple authentication types in my app; in particular: some parts of the app require authentication to dropbox, and some parts require email-based authentication such as browserID. How can I handle this? Can I attach…
rlpowell
  • 1,160
  • 1
  • 9
  • 13
36
votes
3 answers

Yesod: Getting a database entity by ID from an Int

I'm new to both Haskell and Yesod, and am trying to build a simple web application that can answer queries from an external API. I have built a parser (using Parsec), that gets me the ID of an entity I want to load as a regular Int value. However, I…
32
votes
1 answer

What are the rules about concurrently accessing a persistent database

It seems the rules about concurrent access are undocumented (on the Haskell side) and simply assume the developer is familiar with the particular backend being used. For production needs this is a perfectly legitimate assumption, but for casual…
Thomas M. DuBuisson
  • 64,245
  • 7
  • 109
  • 166
31
votes
4 answers

Deploying Yesod to Heroku, can't build statically

I'm very new to Yesod and I'm having trouble building Yesod statically so I can deploy to Heroku. I have changed the default .cabal file to reflect static compilation if flag(production) cpp-options: -DPRODUCTION ghc-options: -Wall…
asm
  • 8,758
  • 3
  • 27
  • 48
30
votes
1 answer

How to convert from lazy text to non-lazy text?

I am new to Haskell, so this may be a trivial problem. I am seeing an error message that says Couldn't match expected type 'Data.Text.Lazy.Internal.Text' with actual type 'Data.Text.Internal.Text' and I think the problem is that the actual type is…
akonsu
  • 28,824
  • 33
  • 119
  • 194
21
votes
1 answer

Why can't the Yesod session cookie be hijacked?

The Yesod book says The encryption prevents the user from inspecting the data, and the signature ensures that the session can be neither hijacked nor tampered with. It's not clear to me why this is the case. If an eavesdropper gets hold of the…
Jyotirmoy Bhattacharya
  • 9,317
  • 3
  • 29
  • 38
20
votes
1 answer

How can I use Yesod's authentication with websockets?

I want to make use of websockets in my Yesod application. If my understanding of the websockets package is correct, this means I will need to define a ServerApp, which is a function PendingConnection -> IO () for how to handle connection requests,…
dphilipson
  • 312
  • 1
  • 7
17
votes
1 answer

How do I implement a shutdown command in a WAI server?

I'd like to implement a 'graceful shutdown' command for my webapp (as opposed to my first instinct, which is to just ask people to kill the process) My first two attempts consisted of liftIO exitSuccess E.yield (responseLBS statusOK [G.contentType…
kowey
  • 1,211
  • 7
  • 15
17
votes
1 answer

Passing app secrets in Yesod and Keter

I'm building a web app with Yesod and am currently passing in secrets such as API keys via environment variables (as per The Twelve-Factor App) to avoid storing these values in version-controlled configuration files. For example, I run my app in dev…
Richard Cook
  • 32,523
  • 5
  • 46
  • 71
16
votes
0 answers

Type safe RPC call example from GHCJS client to Yesod/Snap/Servant

I have two, related questions about RPC call to Yesod/Snap/Servant: Say I have a function on the server, written in Haskell, compiled by GHC: add x y = x+y+42 How can: I call this function from the client (the client is also written in Haskell,…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
16
votes
2 answers

How can I implement HATEOAS in Haskell?

I have some old code which exposes services on a web API which works basically on HTTP verbs. I'd like to move this project to use hypermedia controls (HATEOAS). I'm wondering if there are any libraries already that support embedding links in…
opensourcegeek
  • 5,552
  • 7
  • 43
  • 64
16
votes
1 answer

yesod persistent postgresql complex record

I am using persistent to save the following records (Time is UTCTime). type Price = Int type Volume = Int share [mkPersist sqlSettings, mkMigrate "migrateBook"] [persistLowerCase| Level limit Price volumes [Volume] …
Maarten
  • 1,037
  • 1
  • 11
  • 32
1
2 3
88 89