Twain
Tiny web application framework for WAI.
Install / Use
/learn @alexmingoia/TwainREADME
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..."
Related Skills
node-connect
336.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.0kCommit, push, and open a PR
