on master help sign in
Merge pull request #18 from tazjin/master
b400d8bEvan Czaplicki
elm-yesod/LICENSEdeleted−30
@@ -1,30 +0,0 @@
1−Copyright (c)2012, Evan Czaplicki
2−
3−All rights reserved.
4−
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
7−
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
10−
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
15−
16− * Neither the name of Evan Czaplicki nor the names of other
17− contributors may be used to endorse or promote products derived
18− from this software without specific prior written permission.
19−
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elm-yesod/Language/Elm/Yesod.hsdeleted−57
@@ -1,57 +0,0 @@
1−{-# LANGUAGE QuasiQuotes, TypeSynonymInstances #-}
2−{- | This module provides a function for compiling Elm source code into a Yesod widget.
3− In order to use this with your Yesod app, you need to define a defaultLayout like
4− function that embeds the elm-min.js file /in the <head> tag/.
5−
6− For example, you could modify your Yesod instance as follows:
7−
8− > instance Yesod App where
9− > jsLoader _ = BottomOfHeadBlocking -- moves JS to the <head> tag
10− > defaultLayout widget = do
11− > pc <- widgetToPageContent $ do
12− > addScriptRemote $ "http://somecdn.org/link/to/elm-min.js"
13− > ...
14− > ...
15−
16− A full example implementation is provided in the examples folder of the Elm github repository.
17−-}
18−module Language.Elm.Yesod (
19− elmWidget
20− , ElmUrl) where
21−
22−import Control.Monad (liftM)
23−import Text.Blaze (preEscapedToMarkup)
24−import Text.Julius
25−import Yesod.Core (Route (..))
26−import Yesod.Handler (getUrlRenderParams, GHandler (..))
27−import Yesod.Widget
28−import Language.Elm
29−import Language.Elm.Quasi
30−
31−import qualified Data.Text as TS
32−import qualified Data.Text.Lazy as TL
33−
34−-- |elmWidget returns a Yesod widget from some Elm source code
35−-- with URL interpolation.
36−elmWidget :: ElmUrl (Route master) -- ^ Elm source code
37− -> GHandler sub master (GWidget sub master())
38−elmWidget source = do
39− urlF <- getUrlRenderParams
40− return $ mkElmWidget source urlF
41−
42−
43−mkElmWidget :: ElmUrl (Route master) -- ^ Elm source code
44− -> RenderFn (Route master) -- ^ URL rendering function
45− -> GWidget sub master ()
46−mkElmWidget source urlFn =
47− let (html, css, js) = toParts (urlFn, source) in
48− do toWidgetHead css
49− toWidgetHead [julius| #{js} |]
50− toWidgetBody html
51−
52−
53−-- | Return type of template-reading functions.
54−type ElmUrl url = (url -> [(TS.Text, TS.Text)] -> TS.Text) -> Elm
55−
56−-- | Readability synonym for render function
57−type RenderFn url = (url -> [(TS.Text, TS.Text)] -> TS.Text)
elm-yesod/elm-yesod.cabaldeleted−36
@@ -1,36 +0,0 @@
1−Name: Elm-yesod
2−Version: 0.1.2
3−Synopsis: The Elm language Yesod compatibility module.
4−Description: This module provides a simple function to embed Elm code
5− as a Yesod widget.
6−
7−Homepage: http://elm-lang.org
8−
9−License: BSD3
10−License-file: LICENSE
11−
12−Author: Vincent Ambo
13−Maintainer: geva@humac.com
14−Copyright: Copyright: (c) 2011-2012 Vincent Ambo
15−
16−Category: Compiler, Language
17−
18−Build-type: Simple
19−
20−Extra-source-files: README.md
21−Cabal-version: >=1.6
22−
23−source-repository head
24− type: git
25− location: git://github.com/evancz/Elm.git
26−
27−Library
28− exposed-modules: Language.Elm.Yesod
29− Build-depends: base >=4.2 && <5,
30− blaze-markup == 0.5.*,
31− Elm == 0.1.2,
32− yesod-core >= 1,
33− hamlet,
34− shakespeare-css,
35− shakespeare-js,
36− text