Popularity
3.6
Declining
Activity
0.0
Stable
3
3
0

Monthly Downloads: 17
Programming language: Haskell
License: LicenseRef-GPL
Tags: Text     Web    

hack-contrib-press alternatives and similar packages

Based on the "Text" category.
Alternatively, view hack-contrib-press alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of hack-contrib-press or a related project?

Add another 'Text' Package

README

Hack.Contrib.Press

Quickstart

Small.hs

{-# LANGUAGE DeriveDataTypeable #-}
{-# OPTIONS -fglasgow-exts #-}

module Main where

import Hack
import Hack.Contrib.Press (renderToResponse)
import Hack.Handler.Happstack (run)
import Text.JSON.Generic

data Profile = Profile {
    name :: String,
    favoriteMusic :: [String]
} deriving (Data, Typeable)

main = run $ \env -> do renderToResponse env "small.html" context
    where aProfile = Profile "Brandon Bickford" ["Rock"]
          context = [toJSON aProfile]

small.html

<html>
    <body>
        <p>
            Hey <b>{{ name }}</b>, I heard you like:
            <ul>
                {% for music in favoriteMusic %}
                    <li>{{ music }}</li>
                {% endfor %}
            </ul>     
        </p>
    </body>
</html>

Run

  • Run: cabal install hack-contrib-press
  • Add "Small.hs" and "small.html"
  • Run: ghc --make -o small Small.hs
  • Run: ./small
  • In your browser visit: http://localhost:3000