The chu2 package

[Tags: bsd3, library]

FFI for Chu2 Agda Web Server Interface


[Skip to ReadMe]

Properties

Versions2012.11.16, 2012.11.16.1, 2012.11.17, 2012.11.17.1, 2012.11.17.2, 2012.11.18, 2012.11.18.1, 2012.11.18.2, 2012.11.19, 2012.11.20
Change logNone available
Dependenciesbase (>=4 && <6), bytestring, data-default, hack2, hack2-handler-snap-server, utf8-string [details]
LicenseBSD3
AuthorJinjing Wang
MaintainerJinjing Wang <nfjinjing@gmail.com>
CategoryWeb
Home pagehttps://github.com/nfjinjing/chu2
UploadedTue Nov 20 02:11:49 UTC 2012 by JinjingWang
DistributionsNixOS:2012.11.20
Downloads1542 total (88 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for chu2-2012.11.20

Chu2 Agda Web Server Interface

hello world example

module Hello where

open import IO              using (return) renaming (run to io)
open import Data.List       using ([])
open import Function        using (const)
open import Chu2            using (response; OK; Application) 

hello-world-response = response OK [] ("Hello Agda!")

hello-world-app : Application
hello-world-app = const (return hello-world-response)

open import Chu2.Handler.SnapServer using (on-port_run)
main = io (on-port 3000 run hello-world-app)

Using Middleware

module Hello2 where

-- simple-logger middleware
open import Chu2.Middleware.SimpleLogger using (simple-logger)

open import IO              using (return) renaming (run to io)
open import Function        using (const)
open import Chu2            using (Application; default-response)

default-app : Application
default-app = const (return default-response)

app : Application
app = simple-logger default-app

open import Chu2.Handler.SnapServer using (on-port_run)
main = io (on-port 3001 run app)

Full spec

Chu2.agda

Note