snap-core

Snap: A Haskell Web Framework (core interfaces and types) http://snapframework.com/

Version on this page:0.9.6.4
LTS Haskell 15.14:[email protected]:1
Stackage Nightly 2020-05-31:[email protected]:1
Latest on Hackage:[email protected]:1

See all snapshots snap-core appears in

BSD-3-Clause licensed by James Sanders, Shu-yu Guo, Gregory Collins, Doug Beardsley
Maintained by [email protected]

Module documentation for 0.9.6.4

This version can be pinned in stack with:[email protected]:fa823e4ad8566e7503edf231ea08b9b98d880ffa9a3bd20bf8ae80c5ca6ba3cf,5899
  • Snap
    • Snap.Core
    • Snap.Internal
      • Snap.Internal.Debug
      • Snap.Internal.Exceptions
      • Snap.Internal.Http
        • Snap.Internal.Http.Types
      • Snap.Internal.Iteratee
        • Snap.Internal.Iteratee.Debug
      • Snap.Internal.Parsing
    • Snap.Iteratee
    • Snap.Test
    • Snap.Types
      • Snap.Types.Headers
    • Snap.Util
      • Snap.Util.FileServe
      • Snap.Util.FileUploads
      • Snap.Util.GZip
      • Snap.Util.Proxy
      • Snap.Util.Readable

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.