snap-core

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

http://snapframework.com/

Version on this page:1.0.5.1@rev:5
LTS Haskell 22.39:1.0.5.1@rev:6
Stackage Nightly 2024-10-31:1.0.5.1@rev:6
Latest on Hackage:1.0.5.1@rev:6

See all snapshots snap-core appears in

BSD-3-Clause licensed by Snap Framework Authors (see CONTRIBUTORS)
Maintained by [email protected]
This version can be pinned in stack with:snap-core-1.0.5.1@sha256:c1112eaf146b15abe287479138cd8babd43c7d45d56cbb677adf3149e7d05f0b,9822

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.

Changes

1.0.5.0

  • Add head helper for Snap.Test
  • Add support for GHC 9
  • Expose Snap.Internal.Util.FileServe
  • Ensure parseHttpTime returns 0 on invalid input
  • Add test helper for HEAD requests
  • Misc version bumps

1.0.4.0

  • Allow network 3.0.

1.0.3.2

  • Allow unix-compat 0.5

  • Stop using deprecated Data.Map.insertWith’

  • Test with GHC 8.4.1

1.0.3.1

  • Allow io-streams 1.5.

1.0.3.0

Added

  • Alternative file upload handling into Snap.Util.FileUploads

Fixes

  • Fixed parsing of field values in multipart/form-data headers with encodings other than US-ASCII

1.0.2.1

Dependencies

  • Allow io-streams 1.4.

1.0.2.0

Added

  • Merged CORS functionality from snap-cors project into Snap.Util.CORS

Dependencies

  • Bumped time dependency.

1.0.1.1

Fixes

  • Fixed a bug in token parsing in Snap.Util.Parsing

1.0.1.0

Fixes

  • fixed a FileUpload exception test

  • Exported compressibleMimeTypes

  • Added a missing file to the tarball.

1.0.0.0

Added

Removed

  • Removed support for iteratees in favor of io-streams