@@ -15,21 +15,20 @@
16 A full example implementation is provided in the examples folder of the Elm github repository.
16 A full example implementation is provided in the examples folder of the Elm github repository.
18−module Language.Elm.Yesod (toWidget) where
18+module Language.Elm.Yesod (elmWidget) where
20import Text.Blaze (preEscapedToMarkup)
20import Text.Blaze (preEscapedToMarkup)
22import Text.Julius
21import Text.Julius
23−import Yesod.Widget (toWidgetHead, whamlet, GWidget)
22+import Yesod.Widget (toWidgetHead, toWidgetBody, GWidget)
24import Language.Elm
23import Language.Elm
26-- |toWidget takes some Elm code in String format and produces a widget. Usage example:
25-- |toWidget takes some Elm code in String format and produces a widget. Usage example:
28-- > toWidget [elmFile|elm-source/somePage.elm|]
27-- > toWidget [elmFile|elm-source/somePage.elm|]
29−toWidget :: String -- ^ The Elm source code
28+elmWidget :: String -- ^ The Elm source code
30− -> GWidget sub master ()
29+ -> GWidget sub master ()
31−toWidget source =
30+elmWidget source =
32 let (html, css, js) = toParts source in
31 let (html, css, js) = toParts source in
33− do toWidgetHead [hamlet| #{css} |]
32+ do toWidgetHead css
34 toWidgetHead [julius| #{js} |]
33 toWidgetHead [julius| #{js} |]
35− [whamlet| ^{html} |]
34+ toWidgetBody html