snap-core: Snap: A Haskell Web Framework (core interfaces and types)

[ bsd3, io-streams, library, snap, web ] [ Propose Tags ]

Snap is a simple and fast web development framework and server written in Haskell. For more information or to download the latest version, you can visit the Snap project website at http://snapframework.com/.

This library contains the core definitions and types for the Snap framework, including:

  1. Primitive types and functions for HTTP (requests, responses, cookies, post/query parameters, etc)

  2. Type aliases and helper functions for Iteratee I/O

  3. A monad for programming web handlers called "Snap", which allows:

  • Stateful access to the HTTP request and response objects

  • Monadic failure (i.e. MonadPlus/Alternative instances) for declining to handle requests and chaining handlers together

  • Early termination of the computation if you know early what you want to return and want to prevent further monadic processing

Quick start: The Snap monad and HTTP definitions are in Snap.Core, some iteratee utilities are in Snap.Iteratee.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
portable

Compile in cross-platform mode. No platform-specific code or optimizations such as C routines will be used.

Disabled
debug

Enable debug logging code. With this flag, Snap will test the DEBUG environment variable to decide whether to do logging, and this introduces a tiny amount of overhead (a call into a function pointer) because the calls to debug cannot be inlined.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.1, 0.1.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.7.1, 0.2.8, 0.2.8.1, 0.2.9, 0.2.10, 0.2.11, 0.2.12, 0.2.13, 0.2.14, 0.2.15, 0.2.15.1, 0.2.16, 0.3.0, 0.3.1, 0.3.1.1, 0.4.0, 0.4.0.1, 0.4.0.2, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.5.1, 0.5.1.1, 0.5.1.2, 0.5.1.3, 0.5.1.4, 0.5.2, 0.5.3, 0.5.3.1, 0.5.4, 0.5.5, 0.6.0, 0.6.0.1, 0.7, 0.7.0.1, 0.8.0, 0.8.0.1, 0.8.1, 0.9.0, 0.9.2, 0.9.2.1, 0.9.2.2, 0.9.3, 0.9.3.1, 0.9.4.0, 0.9.4.1, 0.9.5.0, 0.9.6.0, 0.9.6.1, 0.9.6.2, 0.9.6.3, 0.9.6.4, 0.9.7.0, 0.9.7.2, 0.9.8.0, 1.0.0.0, 1.0.1.0, 1.0.1.1, 1.0.2.0, 1.0.2.1, 1.0.3.0, 1.0.3.1, 1.0.3.2, 1.0.4.0, 1.0.4.1, 1.0.4.2, 1.0.5.0, 1.0.5.1
Dependencies attoparsec (>=0.10 && <0.14), attoparsec-enumerator (>=0.3 && <0.4), base (>=4 && <5), blaze-builder (>=0.2.1.4 && <0.5), blaze-builder-enumerator (>=0.2 && <0.3), bytestring (>=0.9 && <0.11), bytestring-mmap (>=0.2.2 && <0.3), case-insensitive (>=0.3 && <1.3), containers (>=0.3 && <1.0), deepseq (>=1.1 && <1.5), directory (>=1 && <2), enumerator (>=0.4.15 && <0.5), filepath (>=1.1 && <2.0), hashable (>=1.1 && <1.2 || >=1.2.1 && <1.3), HUnit (>=1.2 && <2), MonadCatchIO-transformers (>=0.2.1 && <0.4), mtl (>=2.0 && <2.3), old-locale (>=1 && <2), random (>=1 && <2), regex-posix (>=0.95 && <1), text (>=0.11 && <1.3), time (>=1.0 && <1.7), time-locale-compat (>=0.1 && <0.2), unix (>=2.4 && <3.0), unix-compat (>=0.2 && <0.5), unordered-containers (>=0.1.4.3 && <0.3), vector (>=0.6 && <0.12), zlib-enum (>=0.2.1 && <0.3) [details]
License BSD-3-Clause
Author James Sanders, Shu-yu Guo, Gregory Collins, Doug Beardsley
Maintainer snap@snapframework.com
Revised Revision 1 made by DougBeardsley at 2016-11-06T18:01:57Z
Category Web, Snap
Home page http://snapframework.com/
Source repo head: git clone git://github.com/snapframework/snap-core.git
Uploaded by GregoryCollins at 2015-08-20T04:19:35Z
Distributions Arch:1.0.5.1, Debian:1.0.4.2, Fedora:1.0.5.1, FreeBSD:0.9.7.2, LTSHaskell:1.0.5.1, NixOS:1.0.5.1, Stackage:1.0.5.1
Reverse Dependencies 72 direct, 146 indirect [details]
Downloads 125737 total (335 in the last 30 days)
Rating 2.5 (votes: 5) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-08-20 [all 1 reports]

Readme for snap-core-0.9.8.0

[back to package description]

Snap Framework Core

Snap is a web framework for Haskell, based on iteratee I/O (as popularized by Oleg Kiselyov). For more information about Snap, read the README.SNAP.md or visit the Snap project website at http://www.snapframework.com/.

Library contents

This is the snap-core library, which contains:

  • primitive types and functions for HTTP (requests, responses, cookies, post/query parameters, etc).

  • type aliases and helper functions for Iteratee I/O.

  • a "Snap" monad interface, inspired by happstack's, for programming web handlers, which allows:

    • stateful access to the HTTP request and response objects.

    • monadic failure (i.e. MonadPlus/Alternative instances) for declining to handle requests and chaining handlers together.

    • early termination of the computation if you know early what you want to return and want to prevent further monadic processing.

  • Some useful utilities for web handlers, including gzip/zlib compression.

Building snap-core

The snap-core library is built using Cabal and Hackage. Just run

cabal install

from the snap-core toplevel directory.

Building the Haddock Documentation

The haddock documentation can be built using the supplied haddock.sh shell script:

./haddock.sh

The docs get put in dist/doc/html/.

Building the testsuite

Snap is still in its very early stages, so most of the "action" (and a big chunk of the code) right now is centred on the test suite. Snap aims for 100% test coverage, and we're trying hard to stick to that.

To build the test suite, cd into the test/ directory and run

$ cabal configure
$ cabal build

From here you can invoke the testsuite by running:

$ ./runTestsAndCoverage.sh 

The testsuite generates an hpc test coverage report in test/dist/hpc.