@hackage / snap-core

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

Latest1.0.5.1

About

Metadata

  • Last updated , by AndreasAbel
  • License BSD-3-Clause
  • Categories Web Development
  • Maintained by: snap@snapframework.com

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 9.8.1
  2. 9.6.3
  3. 9.4.7
  4. 9.2.8
  5. 9.0.2
  6. 8.10.7
  7. 8.8.4

Package Flags

Use the -f option with cabal commands to enable flags

    portable (off by default)

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

    debug (off by default)

    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.

    network-uri (on by default)

    Get Network.URI from the network-uri package

Readme

Snap Framework Core

GitHub CI

Snap is a web framework for Haskell. 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).

  • a "Snap" monad interface 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.

  • useful utilities for web handlers, like file serving and 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 aims for 100% test coverage, and we're trying hard to stick to that.

To build the test suite, configure with --enable-tests:

$ cabal configure --enable-tests
$ cabal build

From here you can invoke the testsuite by running:

$ ./runTestsAndCoverage.sh

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