Giter VIP home page Giter VIP logo

learn-snap's Introduction

This is a sample Snap application that uses Heist for templating and digestive-functors for forms. Contributions of additional sample forms or Heist library usage are very welcome! Additional details and build instructions below.

Heist

Heist is a Haskell templating library commonly used with the Snap Framework. Heist keeps business logic out of the templates by giving you facilities for manipulating the templates in code. For instance, extracting and repeating template nodes from code instead of having a special template syntax for looping and conditions.

Digestive Functors

Digestive Functors is a Haskell form library inspired by Formlets and providing a succinct API for building and validating forms. You can use this library independent of any web framework or templating system, but the examples here will use it exclusively with Snap and compiled Heist.

learn-snap

Although each of the libraries used here have nice documentation and a few examples, there aren't many (or at the time of this writing, any) examples showing how they all work together. The aim of this site is to show off how easy and effective it is to build a form-heavy website using this libraries, and to offer a fully working codebase that you can clone and experiment with.

Build steps (using the nix package manager)

  1. git clone [email protected]:ericrasmussen/learn-snap.git
  2. cd learn-snap
  3. nix-build

Build steps (using cabal sandboxes)

This was last built with ghc 7.6.3 and cabal 1.18.0. These steps assume you have those installed at the same major versions (ghc in particular sometimes introduces breaking changes in new major versions, so no guarantees for this building easily in future versions).

  1. git clone [email protected]:ericrasmussen/learn-snap.git
  2. cd learn-snap
  3. cabal sandbox init
  4. cabal install --only-dependencies
  5. (wait patiently)
  6. cabal build
  7. dist/build/snap-heist-examples/learnsnap -p 3000

The last step will launch the app and server locally on port 3000 (you can use a different port if you like, and it will default to 8000 if unspecified).

At that point you can interact with it in your browser (usually localhost:3000), modify the templates and restart the application to see the changes, or change the code and run cabal build again.

Have fun!

learn-snap's People

Contributors

ericrasmussen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dbp alexanderaa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.