Hi,
I'm a somewhat proficient Haskell programmer, but I'm having trouble seeing the
forest for the trees with Snap. My needs are pretty modest and I think Snap
will be perfect. All I need is to figure out how to set up Snap with Heist and
an HDBC connection. Unfortunately, this is my first exposure to iteratees
(though I think I grasp the concept) and my first real use of monad
transformers, which I think is part of the problem, plus Snap itself is so new.
I'd greatly appreciate just a little assistance getting a trivial Snap webapp
going, doing nothing more than rendering a bit of Heist backed by a trivial
database query. I think I can handle it from there if I can just get that set
up.
Starting with this trivial program:
module Main where
import Database.HDBC
import Database.HDBC.PostgreSQL
trivialQuery ∷ Connection → IO Integer
trivialQuery db = do
[[SqlInteger res]] ← quickQuery db "SELECT COUNT(*) FROM foo" []
return res
main = do
db ← connectPostgreSQL "user=fusion dbname=fusion"
count ← trivialQuery db
putStrLn $ show count
I'm having some trouble seeing how to 1) make a tag that represents
trivialQuery, and 2) call it from a template, 3) with Snap serving it.
I must apologize for how basic this is! I don't know why I'm having so much
trouble. Thanks for your help!
--
Daniel Lyons
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap