yesod-lucid (empty) → 0.1
raw patch · 4 files changed
+97/−0 lines, 4 filesdep +basedep +luciddep +monads-tfsetup-changed
Dependencies added: base, lucid, monads-tf, text, yesod-core
Files
- LICENSE +24/−0
- Setup.hs +3/−0
- Yesod/Lucid.hs +45/−0
- yesod-lucid.cabal +25/−0
+ LICENSE view
@@ -0,0 +1,24 @@+Copyright (c) 2014, haskell-lang+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:+ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ * Neither the name of haskell-lang nor the+ names of its contributors may be used to endorse or promote products+ derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ Yesod/Lucid.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++-- | Lucid support for Yesod.+--+-- Example Handler for a route, using Lucid to generate html,+-- including a rendered url:+--+-- > import Yesod.Lucid+-- > import Lucid+-- > +-- > getExampleR :: Handler LucidHtml+-- > getExampleR = lucid $ \url ->+-- > p_ $ a_ [href_ (url ExampleR)] "self link"++module Yesod.Lucid where++import Control.Monad.Identity+import Data.Text (Text)+import Lucid+import Yesod.Core (ToTypedContent, MonadHandler, ToContent, Route,+ HandlerSite, HasContentType(..))+import qualified Yesod.Core as Y++-- | Handler LucidHtml can be used for yesod handlers that use lucid to+-- generate html.+type LucidHtml = Html ()++-- | A lucid generator.+type LucidGen a = (Route a -> Text) -> LucidHtml++-- | Output some lucid, passes a URL renderer to the continuation.+lucid :: MonadHandler m => LucidGen (HandlerSite m) -> m LucidHtml+lucid cont = fmap cont Y.getUrlRender++instance ToTypedContent (Html ()) where+ toTypedContent m = Y.TypedContent (getContentType (Just m)) (Y.toContent m)++instance ToContent (Html ()) where+ toContent html = Y.ContentBuilder (runIdentity (execHtmlT html)) Nothing++instance HasContentType (Html ()) where+ getContentType _ = "text/html"
+ yesod-lucid.cabal view
@@ -0,0 +1,25 @@+Name: yesod-lucid+Version: 0.1+Synopsis: Lucid support for Yesod+Description: Allows using Lucid to generate html in a yesod site.+License: BSD3+License-File: LICENSE+Author: Chris Done+Maintainer: Joey Hess <id@joeyh.name>+Copyright: 2014 Chris Done+Category: Web, Yesod+Build-Type: Simple+Cabal-Version: >= 1.8++Library+ GHC-Options: -Wall+ Exposed-Modules: Yesod.Lucid+ Build-Depends: base (>= 4.5), base < 5+ , yesod-core (>= 1.1.5 && < 1.5)+ , lucid (>= 2.9 && < 3.0)+ , monads-tf (>= 0.1 && < 1.0)+ , text (>= 1.0 && < 2.0)++source-repository head+ type: git+ location: git://git.joeyh.name/yesod-lucid.git