Skip to content
Fay integration for Snap that provides automatic (re)compilation during development
JavaScript Haskell Smarty CSS HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Snaplet Fay

Snaplet Fay integrates Snap with Fay. Snap is a Haskell web framework and Fay is a compiler from a proper subset of Haskell to JavaScript. Snaplet Fay integrates them nicely with each other allowing automatic (re)compilation of Fay source files. Snap provides this for both static content and haskell sources preventing web server restarts and here we add Fay to this list as well. This lets us write both front and back-end code in Haskell.


You will need Haskell, Snap and Fay installed. The simplest way to get up and running with Haskell is to install The Haskell Platform.

Snap and Fay are available on hackage, but use chrisdone's master for now:

cabal install snap
git clone && cd fay && cabal install

Clone this repository and install the package:

cabal install

Example Usage


import Snap.Snaplet.Fay

app :: SnapletInit App App
app = makeSnaplet "app" "An snaplet example application." Nothing $ do
  -- Put Fay .hs files in src/Fay
  -- The verbosity Bool parameter tells Snap Fay how much information it should
  -- print about what it's doing.
  fay' <- nestSnaplet "fay" fay $ initFay "src/Fay" True
  return $ App { _fay = fay' }


import Snap.Snaplet.Fay

data App = App { _fay :: Snaplet Fay }

makeLens ''App

Development Status

Snaplet Fay is functioning and will be updated to keep up with both Snap and Fay.


Fork on!

Any enhancements are welcome.

To run the tests, do:

cabal configure -ftest
cabal build


File an issue, e-mail or visit #fay @

Something went wrong with that request. Please try again.