Questions tagged [happstack]

Happstack is a fast and flexible Haskell web framework.

Happstack is a fast and flexible Haskell web framework.

111 questions
1
vote
1 answer

Finding a working Happstack / Heist example

I would like to start using Haskell to build web sites, and think that Happstack, Heist, and Web-routes would be a good combination. Unfortunately, I cannot find working code. The crash course example does not compile. I downloaded the…
MattoxBeckman
  • 3,682
  • 2
  • 20
  • 16
1
vote
1 answer

HappStack event files

I am developing a game and chose Happstack for the persistence part. I find it quite easy to use, i made a quick example for myself to understand it: getAllObjects :: MonadIO m => m [Thing] getAllObjects = do elems <- query GetObjects …
Illiax
  • 1,002
  • 1
  • 8
  • 21
1
vote
1 answer

Haskell do notation vs (>>) operator, happstack routing with 'method'

I am learning Haskell, and I'm trying to learn the happstack server as well. I am following the guide at http://happstack.com/docs/crashcourse/index.html#matching-on-request-method-get-post-etc , and their usage of the 'dir' and 'method' functions…
Mattマット
  • 81
  • 1
  • 4
1
vote
1 answer

Haskell Monads msum in HappStack

From http://happstack.com/docs/crashcourse/HappstackState.html When I run the server, the peek counter increases by 1 when I peek 2 when I do not peek The relevant code in question is: handlers :: ServerPart Response handlers = msum [ dir…
Dingfeng Quek
  • 898
  • 5
  • 14
1
vote
2 answers

How to host a Happstack website?

I've built a website using Happstack, but I have no experience in hosting. Everything I found online was either outdated or too complex for me. Is there an easy way, or tutorial I can follow to publish my Happstack website? Thanks
Hilton Pintor
  • 300
  • 2
  • 8
1
vote
1 answer

Create a custom happstack response code

I have been trying to create a custom happstack response the 405 "Method not allowed" so if someone calls the API with a POST or PUT method they will get this response. I am new to happstack. Any ideas how I can do that?
ib1
  • 11
  • 4
1
vote
1 answer

Reading request body twice in happstack-server

I have a problem reading the body twice in a happstack-server application. I have embeded a library for user authentication (happstack-authenticate). happstack-authenticate has an JSON-Api to manage users and I trying access the same request body…
alex.b
  • 184
  • 1
  • 2
  • 15
1
vote
1 answer

How to pass HTTP request parameter to quickQuery?

I'm using Happstack to receive some parameters from an HTTP request then pass these parameters to a function that will retrieve data from the database and return this data in the HTTP response as follow: myFunc :: IO String myFunc = do r <- look…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
1 answer

How to use "IO String" as an HTTP response in Happstack?

I'm retrieving data from a database using HDBC, then trying to send this data to a web client using Happstack. myFunc :: Integer -> IO String myFunc = ... fetch from db here ... handlers :: ServerPart Response handlers = do decodeBody…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
0 answers

Happstack SSL error - wrong tag

I am trying to run happstack-tls server using certificate generated by certbot, however, when I run it I get user error (error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag) and program ends. I tried to use both pem and der versions of…
radrow
  • 6,419
  • 4
  • 26
  • 53
1
vote
1 answer

What's the syntax of using multiple handlers in Happstack?

Sorry for my basic question, but I'm new to Haskell. I'm following this example to receive some values from a request body, but my server also serves static files from a directory using the following code: fileServing :: ServerPart…
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
1
vote
1 answer

Haskell error: couldn't match expected type ‘ServerPartT IO a0’ with actual type '[Response]'

When I tried to compile the code, two errors occur. the first one is: Couldn't match expected type ‘ServerPartT IO a0’ with actual type ‘[Response]’ In a stmt of a 'do' block: msum (map (\ (a, b) -> dir a b) $ routes …
Mia.M
  • 97
  • 1
  • 1
  • 8
1
vote
1 answer

How to define a variable contained in a tuple?

Every time I tried to run this code, the compiler returns a 'not in scope' error for the variables redirectUrlGraphEmail, redirectUrlGraphPost, aboutContents, and staticDir: routes :: [ (String, ServerPart Response)] routes = [ ("graph-fb", seeOther…
Mia.M
  • 97
  • 1
  • 1
  • 8
1
vote
1 answer

What should a Route look like in Happstack code?

runServer :: IO () runServer = do configureLogger staticDir <- getStaticDir redirectUrlGraphEmail <- retrieveAuthURL testUrl redirectUrlGraphPost <- retrieveAuthURL testPostUrl aboutContents <- LazyIO.readFile $ markdownPath ++…
Mia.M
  • 97
  • 1
  • 1
  • 8
1
vote
1 answer

GHCi interactive linking error during happstack-server installation

I’m trying to build a project in a cabal sandbox that depends on happstack-server, but this package fails to build. Here is the content of .cabal-sandbox/logs/happstack-server-7.4.6.1.log: Building happstack-server-7.4.6.1... Preprocessing library…
WilQu
  • 7,131
  • 6
  • 30
  • 38