The bird package

[ Tags: bsd3, library, program, web ] [ Propose Tags ]

Bird is a hack-compatible framework for simple websites.

[Skip to Readme]


Versions 0.0.1, 0.0.2, 0.0.3, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.14, 0.0.15, 0.0.16, 0.0.17, 0.0.18, 0.0.19
Dependencies base (>=4.0 && <5), bytestring, containers, data-default (>=0.2), hack (>=2009.10.30), hack-handler-happstack, haskell98, mtl (>=, parsec (>=, process, rallod [details]
License BSD3
Author Parker, Matt
Maintainer Parker, Matt <>
Category Web
Home page
Uploaded Sat Jul 31 14:03:11 UTC 2010 by MattParker
Distributions NixOS:0.0.19
Executables bird
Downloads 6073 total (130 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for bird-0.0.11

[back to package description]


A sinatra-ish web framework written in haskell, riding on top of Hack.


Sinatra has a beautiful, simple, elegant syntax, but it's essentially an attempt to bring pattern matching to a language never intended for pattern matching. Why not attempt something similar in a language with not just beautiful pattern matching, but with all the declarative bells and whistles: lazy evaluation, first-class functions, currying, polymorphism?


λ cabal update && cabal install bird

Note: make sure $HOME/.cabal/bin is in your PATH.

Create an app

λ bird StarWars 

Compile your app

λ cd StarWars
λ bird nest 
  [1 of 2] Compiling MyApp            ( MyApp.hs, MyApp.o )
  [2 of 2] Compiling Main             ( Main.hs, Main.o )
  Linking Main ...

Start your app (runs on port 3000)

λ bird fly

Try it out

λ curl http://localhost:3000
  Hello, Bird!

λ curl http://localhost:3000?name=Luke
  Hello, Luke


-- StarWars.bird.hs
import Data.String.Utils (join)

get ["droids"] = do
  body "These aren't the droids you're looking for. Move along."
  status 404

get ("force":xs) = do 
  body $ "May the force be with you " ++ (join ", " xs) ++ "!"

get [] = do
  name <- param "name"
  body $ "Greetings, " ++ (maybe "Jedi!" id name)


λ curl http://localhost:3000/force/Han/Chewie
    May the force be with you Han, Chewie!

λ curl http://localhost:3000/droids
    Nothing to see here. Move along.


You have four functions to implement: get, post, put, and delete. They each accept a Bird Request.

Inside the function body, you can use the following methods (don't worry, this list will grow):

param :: String -> Maybe String
-- ex: for the request GET /droids?name=c3po, 
--     then `p <- param "name"' would bind the value `Just "c3po"' to the variable "p"

body :: String -> BirdRouter ()
-- takes a string and sets the Http Response body to whatever the string contained.

status :: Integer -> BirdRouter ()
-- takes a number, and sets the HTTP Reponse header "Status" to that number.


This project is still in its infancy. Coming features:

  • logging
  • support for sending files