hamlet 0.5.1

This commit is contained in:
Michael Snoyman 2010-09-26 12:32:18 +02:00
parent 60fab19ef6
commit 00a01936d4
2 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
-- | Widgets combine HTML with JS and CSS dependencies with a unique identifier
-- generator, allowing you to create truly modular HTML components.
module Yesod.Widget
@ -61,6 +62,19 @@ instance Monoid (GWidget sub master ()) where
-- | A 'GWidget' specialized to when the subsite and master site are the same.
type Widget y = GWidget y y
instance HamletValue (GWidget s m ()) where
newtype HamletMonad (GWidget s m ()) a =
GWidget' { runGWidget' :: GWidget s m a }
type HamletUrl (GWidget s m ()) = Route m
toHamletValue = runGWidget'
htmlToHamletMonad = GWidget' . addBody . const
urlToHamletMonad url params = GWidget' $
addBody $ \r -> preEscapedString (r url params)
fromHamletValue = GWidget'
instance Monad (HamletMonad (GWidget s m ())) where
return = GWidget' . return
x >>= y = GWidget' $ runGWidget' x >>= runGWidget' . y
-- | Lift an action in the 'GHandler' monad into an action in the 'GWidget'
-- monad.
liftHandler :: GHandler sub master a -> GWidget sub master a

View File

@ -32,7 +32,7 @@ library
utf8-string >= 0.3.4 && < 0.4,
template-haskell >= 2.4 && < 2.5,
web-routes-quasi >= 0.6 && < 0.7,
hamlet >= 0.5.0 && < 0.6,
hamlet >= 0.5.1 && < 0.6,
blaze-builder >= 0.1 && < 0.2,
transformers >= 0.2 && < 0.3,
clientsession >= 0.4.0 && < 0.5,