| Safe Haskell | Safe-Infered |
|---|
Language.Elm.Yesod
Description
This module provides a function for compiling Elm source code into a Yesod widget. In order to use this with your Yesod app, you need to define a defaultLayout like function that embeds the elm-min.js file in the <head> tag.
For example, you could modify your Yesod instance as follows:
instance Yesod App where
jsLoader _ = BottomOfHeadBlocking -- moves JS to the <head> tag
defaultLayout widget = do
pc <- widgetToPageContent $ do
addScriptRemote $ "http://somecdn.org/link/to/elm-min.js"
...
...
A full example implementation is provided in the examples folder of the Elm github repository.
Documentation
elmWidget returns a Yesod widget from some Elm source code with URL interpolation.