0:00 / 0:00
Your First Haskell Web App With WAI And Warp by Michael Snoyman #FnConf19
ConfEngine
14K subscribers • 20 videos on Hallway
- Recommended by 1 person: 1 in engineering communities.
- Presented by Michael Snoyman, creator of Yesod
- May be out of date. Uploaded 6 years ago, in an area where tools change fast.
Beginner. No background in the topic needed.
13K views6 years ago1 recommendation
Web developmentProgramming languagesHaskellHTTP, REST and GraphQLWeb performance
Michael Snoyman demonstrates how to build a functioning web server from scratch using Haskell's WAI interface and Warp.
Haskell's Web Application Interface (WAI- pronounced ""why"") provides an abstraction between web applications and web servers. This allows many different web frameworks (e.g., Yesod, Spock, and Servant) to share servers like Warp and middlewares. Haskell's web frameworks offer a wide variety of feature sets, type-level and metaprogramming, and intended use cases. And for most use cases, I would recommend using an existing web framework, which will help you avoid common pitfalls and more quickly address common use cases. But not today! In this tutorial, we're going to step through building a functioning web server using just the bare-bones WAI interface and Warp as a server. Familiarity with the basics of Haskell will be a plus, but this will be a talk open to all FP and Haskell skill levels. More details: confengine.com/functional-conf-2019/proposal/12480 Conference Link: functionalconf.comWhy it's here
1 person recommends thisWhat people say. Engineers point to this tutorial to understand the core design and request-response flow of Haskell's WAI and Warp.
Moments people linked to
u/mistyharshin r/haskell • Mentions
Why does WAI provides a send/respond function when responding to an HTTP request?
I am trying to understand WAI and warp web server. I am going through this video by Michael Snoyman where he explains the problem.
Initially, he presents the core data types here in the video. The `Application` type should be:
type Application = Request -> IO Response
This feels intuitive but it **is not** especially when it streaming of the data using lazy bytes as explained here in the same video. And, then it concludes that the Application type is actually of:
type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
**What I don't understand is how lazy Byt…
u/gilmiin r/haskell • Mentions
On “Monthly Hask Anything (December 2022)”
Since you are fairly new to Haskell I would suggest twain or even using WAI directly. A couple of tutorials:
- https://gilmi.me/blog/post/2022/04/24/learn-twain-bulletin-app
- link to this video
u/Faucelmein r/haskell • Mentions
On “Your First Haskell Web App With WAI And Warp”
Lots of interesting stuff in the video. I wonder why he recommends against using lazy bytestrings at 10:10. Perhaps the `Builder` type is always better?
The "warp" executable provided by wai-app-static is indeed useful. It's the Haskell version of `python3 -m http.server 9000`. Here's a way of installing the warp executable in the current folder using cabal-install >= 3.0:
cabal install --install-method=copy --installdir=. wai-app-static
(In Windows, you might need to run the command inside a cygwin or Git Bash terminal.)
u/gilmiin r/haskell • Mentions
On “Tips for building a web server”
…will be useful for you for the backend side:
1. I haven't read this yet, but there's a WIP book about sockets and pipes that also covers the http spec. Check out the TOC before you buy: https://leanpub.com/sockets-and-pipes
2. This video describes the lower layer interface on which many web frameworks are built (such as scotty, spock and yesod): link to this video
3. This tutorial describes how to build your first application with Spock: https://haskell-at-work.com/episodes/2018-04-09-your-first-web-application-with-spock.html
Good luck!…