Questions tagged [happstack]

Happstack is a fast and flexible Haskell web framework.

Happstack is a fast and flexible Haskell web framework.

111 questions
5
votes
2 answers

Which of Yesod's Warp and snap-server should I choose for a high-performance application server?

I've seen benchmarks on Yesod's homepage, but they are mostly for static files. And the benchmarks on Snap's website are outdated. I'm trying to expose a Haskell module as a service. The server's logic is to receive the function name and arguments…
Vamshi Surabhi
  • 437
  • 4
  • 15
5
votes
1 answer

Is it possible to match on PATCH requests in Happstack?

I was wondering if it is possible to match on PATCH requests in Happstack besides the fact that the Method datatype has no constructor for PATCH: data Method = GET | HEAD | POST | PUT | DELETE | TRACE | OPTIONS | CONNECT However, there are…
Jakob Runge
  • 2,287
  • 7
  • 36
  • 47
5
votes
1 answer

Happstack display a read file

This is a Haskell newb question probably to do with the IO() monad. I've got a function in a Happstack.Server program that generates a response for a file upload. postFile = do methodM POST decodeBody filePolicy (tmp,…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
4
votes
1 answer

Newbie question on syntax and type signature in Haskell/HappStack

Why is it that I can't do z = x? but I can do this? y s = x s I'm a Haskell newbie This is what I've been trying in GHCi: Prelude> import Happstack.Server Prelude Happstack.Server> let x s = ok $ toResponse $ "Some string" Prelude…
Dingfeng Quek
  • 898
  • 5
  • 14
4
votes
1 answer

How to convert from happs -> happstack?

Can anyone help me "translate" the below from happs to happstack: module Main where import HAppS.Server.AlternativeHTTP import HAppS.Server.HTTP.AltFileServe import Control.Monad.State import Numeric import Contracts instance FromData ExContr…
mac
  • 9,885
  • 4
  • 36
  • 51
4
votes
0 answers

How to access the response code in happstack?

I'm trying to store a counter of all 200 response codes in my happstack application. module Main where import Happstack.Server import Control.Concurrent import Control.Monad.IO.Class ( liftIO ) import Control.Monad main :: IO () main = do …
Xavier Shay
  • 4,067
  • 1
  • 30
  • 54
4
votes
2 answers

Combining GET and POST parts in Happstack route filters

I'm trying to implement a simple request handler using Happstack: main :: IO () main = simpleHTTP nullConf app app :: ServerPart Response app = msum [ dir "hello" $ method GET >> helloGet , dir "hello" $ method POST >>…
laserpants
  • 43
  • 4
4
votes
1 answer

Learning Happstack and Monad Transformers

So I have a project that I think is simple enough to learn with, but complex enough to be interesting that I would like to write using the Happstack library. At it's most fundamental level, this project would just be a fancy file server with some…
bheklilr
  • 53,530
  • 6
  • 107
  • 163
4
votes
1 answer

Text index in IxSet

It seems I don't understand how text index in IxSet should work. Here, I created a unit-test that indexes items by tags field, and then query items by tag "tag". It should (from my perspective) give me back all 3 items (because they all have tag…
Konstantine Rybnikov
  • 2,457
  • 1
  • 22
  • 29
4
votes
2 answers

How to find a source code (implementation) of a class in Haskell

I'm reading some documentation on IxSet's http://happstack.com/docs/crashcourse/AcidState.html#ixset , and I was wondering about looking at source of Indexable typeclass which is imported from Data.IxSet. So then I took a repository of Happstack and…
Konstantine Rybnikov
  • 2,457
  • 1
  • 22
  • 29
4
votes
1 answer

Unexpected return type of Acid State query (Happstack)

I'm trying to extend Happstack crash course blog with some additional functionality: displaying a list of all tags on home page. My blog record looks like this: data Blog = Blog { nextPostId :: PostId , posts :: IxSet Post , allTags…
eugenia
  • 43
  • 5
3
votes
1 answer

Extending the ServerPartT Monad with a Reader

I am writing a Happstack server and I have a MongoDB database to connect to. For that, I made a function to create a connection pool type MongoPool = Pool IOError Pipe withMongo :: (MongoPool -> IO a) -> IO () withMongo f = do pool <- dbPool …
Lanbo
  • 15,118
  • 16
  • 70
  • 147
3
votes
2 answers

Can any Haskell web server run Python CGI apps?

I need a web server developed using Haskell to run an old Python CGI application. Any suggestion is appreciated!
z_axis
  • 8,272
  • 7
  • 41
  • 61
3
votes
2 answers

Reducing redundancy in happstack tutorial code

The happstack tutorial provides the following sample: main :: IO () main = simpleHTTP nullConf $ msum [ do methodM GET ok $ "You did a GET request.\n" , do methodM POST ok $ "You did a POST request.\n" ,…
Dax Fohl
  • 10,654
  • 6
  • 46
  • 90
3
votes
1 answer

Catch program errors in Happstack request handler

I'm kind of a noob at Haskell, so I'm not entirely sure if this is a Happstack question or a general Haskell question. Here's an example of the difficulty I'm having. This code "theoretically" renders some content, but actually throws an…
jcarpenter2
  • 5,312
  • 4
  • 22
  • 49