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

Safe HaskellNone

Language.Elm.Yesod

Description

This module provides a function for compiling Elm source code into a Yesod widget.

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

For example:

 instance YesodElm App where
   urlElmJs _ = Right $ "http://link.to/elm-min.js"

or

 instance YesodElm App where
   urlElmJs _ = Left $ StaticR js_elm_min_js

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

:: (Yesod master, 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.