elm-yesod-0.1.2: The Elm language Yesod compatibility module.

Safe HaskellSafe-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

You also need to define an instance of YesodElm, which will specify where to find the elm-min.js file.

A full example implementation is provided in the examples folder of the Elm github repository at https://github.com/tazjin/Elm/tree/master/Examples/elm-yesod.

Synopsis

Documentation

elmWidgetSource

Arguments

:: YesodElm master 
=> ElmUrl (Route master)

Elm source code

-> GWidget sub master () 

elmWidget returns a Yesod widget from some Elm source code with URL interpolation.

class YesodElm master whereSource

Methods

urlElmJs :: a -> Either (Route master) TextSource

The location of the elm-min.js file. This can be either a type-safe route (Left) or a raw string (Right).

type ElmUrl url = (url -> [(Text, Text)] -> Text) -> ElmSource

Return type of template-reading functions.