Questions tagged [happstack]

Happstack is a fast and flexible Haskell web framework.

Happstack is a fast and flexible Haskell web framework.

111 questions
3
votes
0 answers

Happstack seemingly random SSL failure

I have a Haskell application using Happstack that will run fine for anywhere from 1-5 days and then suddenly become unresponsive, with the log looking something like this: ProtocolError "error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed…
ryachza
  • 4,460
  • 18
  • 28
3
votes
0 answers

Happstack ServerPart missing MonadIO instance?

The following code: import Control.Monad.IO.Class import Happstack.Server test :: ServerPart String test = liftIO (putStrLn "Test") >> ok "Test" main = simpleHTTP nullConf test is failing to compile with the message: No instance for (MonadIO…
ryachza
  • 4,460
  • 18
  • 28
3
votes
2 answers

How can I upload a photo to Facebook using Haskell?

I am using Happstack, and I am trying to upload a photograph to Facebook using the Facebook Graph API. I can successfully post a message to Facebook. I can use url, however I am trying to do this with the source parameter. I have a ByteString of PNG…
3
votes
2 answers

Is there a way to get the "current route" in Happstack?

Whenever I use a form in my website, I need to pass an "action" attribute to it (I don't want to leave it empty because I prefer to have validating markup). Right now it looks like this: registerPage = dir "test" $ do nullDir let action =…
hugomg
  • 68,213
  • 24
  • 160
  • 246
3
votes
1 answer

How to send Happstack logs to stdout?

I have a simple hello world happstack app: module Main where import Happstack.Server (nullConf, simpleHTTP, toResponse, ok) main :: IO () main = simpleHTTP nullConf $ ok "Hello, World!" I want it to log requests to stdout. I found this…
Xavier Shay
  • 4,067
  • 1
  • 30
  • 54
3
votes
1 answer

Way to profile IxSet?

I'm continuing development of my program using IxSet and I'm curious if I'm doing something wrong (or it can be optimized). Currently it consumes way too much memory than I believe it should. Program is here:…
Konstantine Rybnikov
  • 2,457
  • 1
  • 22
  • 29
3
votes
1 answer

How is the Markup monad associated with the Html monad?

I'm working with blaze-html. I'm finally mostly being able to wrap my head around how to use it, but some of the monads and transformations really trip me up all the time. But here is one particular stumbling block (out of a great many, but I'll…
Savanni D'Gerinel
  • 2,379
  • 17
  • 27
3
votes
1 answer

CSS with Happstack

I'm wondering what the best way to go about including css in Happstack webpages would be. I tried google, with no luck, so I thought I would ask here.
user721010
3
votes
2 answers

Adding MonadReader/MonadError instances to a Transformer Type

As it's usual when working with Happstack, I have been making my own server monad to use for the handlers, to cover my DB and Sessions, plus some error handling. I have recently discovered the happstack-clientsession-Package that is a big help and…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
2
votes
1 answer

Catching exceptions in happstack-lite handler

I'm writing web application using happstack-lite. When my ServerPart Response handler calls pure function and this function calls error, entire handler fails and happstack prints default error message. handler :: ServerPart Response handler = do …
blaze
  • 4,326
  • 18
  • 23
2
votes
1 answer

Ctrl+C doesn't work in Windows Haskell/happstack

Pressing Ctrl+C (or +Z or anything else) - does not terminate a haskell application (or happstack app) in windows command line (or power shell). Currently I have to close the window, and then open a new command line/power-shell window, navigate to…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
2
votes
1 answer

Catch exceptions in Happstack

I got an exception (used Prelude.head on an empty list) that made all the http-request after that return a 502/505 exception (and the happstack app prints "HTTP request failed with: send resource vanished (Broken pipe)" in stdout). My question is…
Daniel O
  • 4,607
  • 6
  • 44
  • 52
2
votes
2 answers

How to exit from Hackstack Server App?

I'm creating a Happstack server application, but I don't know how to end the application . If I have: main = do printf "begin server" simpleHTTP nullConf myHomepage printf "end server" I can run it ok, and I can kill the application (linux)…
Zhen
  • 4,171
  • 5
  • 38
  • 57
2
votes
1 answer

Is there a way to refactor some of this Happstack form code?

I'm trying to get the GET and the POST from the Happstack tutorial into one handler function so it's always together, which I've kind of achieved, but it seems ugly. login :: ServerPart Response login = msum [ do methodM POST user <-…
Dax Fohl
  • 10,654
  • 6
  • 46
  • 90
2
votes
2 answers

Using html files as templates in happstack

I can find plenty of documentation on using blitz and other compiletime templating libraries with happstack but I would like to know how to use html files as templates.
user181351