Elm-0.1.2.1: The Elm language module.

Safe HaskellNone

Language.Elm.Quasi

Contents

Description

This module contains Shakespearean (see Text.Shakespeare) templates for Elm. It introduces type-safe compile-time variable and URL interpolation. A typeclass ToElm is provided for interpolated variables.

Further reading on Shakespearean templates: http://www.yesodweb.com/book/templates

Further reading on Elm: http://elm-lang.org

Synopsis

Functions

Template-Reading Functions

These QuasiQuoters return functions of the type (t -> Elm) where t is the URL rendering function if type-safe URLs are used.

A usage example for both type-safe (Yesod) and standard path segment (Happstack) URLs is provided in the Examples folder in the Git repository.

elm :: QuasiQuoterSource

QuasiQuoter for embedding Elm code inside of Haskell code.

Usage: [elm|main = plaintext "Some elm code"|]

elmFile :: FilePath -> Q ExpSource

A Template Haskell function for embedding Elm code from external .elm files.

Usage: $(elmFile "elm_source/index.elm")

Datatypes

newtype Elm Source

Newtype wrapper of Builder.

Constructors

Elm 

Fields

unElm :: Builder
 

Instances

Monoid Elm 
ElmSource Elm 
ElmSource (t -> Elm)

 to be used without URL interpolation

ElmSource (t, t -> Elm)

 (urlRenderFn, urlRenderFn -> Elm)

Typeclass for interpolated variables

class ToElm a whereSource

A typeclass for types that can be interpolated in Elm templates.

Methods

toElm :: a -> BuilderSource

Instances

Rendering Functions

renderElm :: Elm -> TextSource

 Render Elm to lazy Text.