| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Tue, 20 Jan 2026 05:08:15 GMT
X-Served-By: cache-dfw-ktki8620066-DFW, cache-bom-vanm7210040-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768885695.777625,VS0,VE301
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
twain: Tiny web application framework for WAI.
[Skip to Readme]
twain: Tiny web application framework for WAI.
Twain is tiny web application framework for WAI. It provides routing, parameter parsing, and an either-like monad for composing responses.
[Skip to Readme]
Downloads
- twain-2.2.0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 1.0.0.0, 2.0.0.0, 2.0.1.0, 2.1.0.0, 2.1.2.0, 2.2.0.0, 2.2.0.1 |
|---|---|
| Change log | changelog.md |
| Dependencies | aeson (>=2 && <3), base (>=4.7 && <5), bytestring (>=0.10 && <0.12), case-insensitive (>=1.2 && <1.3), cookie (>=0.4 && <0.6), either (>=5.0 && <5.1), exceptions (>=0.10 && <0.11), http-types (>=0.12 && <0.13), http2 (>=5.0 && <5.4), text (>=1.2.3 && <3), time (>=1.8 && <2), transformers (>=0.5.6 && <0.7), vault (>=0.3 && <0.4), wai (>=3.2 && <3.3), wai-extra (>=3.0 && <3.2) [details] |
| License | BSD-3-Clause |
| Copyright | 2021 Alexander C. Mingoia |
| Author | Alex Mingoia |
| Maintainer | alex@alexmingoia.com |
| Uploaded | by alexmingoia at 2024-11-05T23:21:05Z |
| Category | Web |
| Home page | https://github.com/alexmingoia/twain#readme |
| Bug tracker | https://github.com/alexmingoia/twain/issues |
| Source repo | head: git clone https://github.com/alexmingoia/twain |
| Distributions | NixOS:2.2.0.1 |
| Downloads | 1267 total (23 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2024-11-06 [all 1 reports] |
Readme for twain-2.2.0.1
[back to package description]Twain
Twain is a tiny web application framework for WAI.
ResponderMfor composing responses with do notation.- Routing with path captures that decompose
ResponderMinto middleware. - Parameter parsing from cookies, path, query, and body.
- Helpers for redirects, headers, status codes, and errors.
{-# language OverloadedStrings #-}
import Network.Wai.Handler.Warp (run)
import Web.Twain
main :: IO ()
main = do
run 8080 $
foldr ($) (notFound missing) routes
routes :: [Middleware]
routes =
[ get "/" index
, post "/echo/:name" echoName
]
index :: ResponderM a
index = send $ html "Hello World!"
echoName :: ResponderM a
echoName = do
name <- param "name"
send $ html $ "Hello, " <> name
missing :: ResponderM a
missing = send $ html "Not found..."