shakespeare-js-1.1.0: Stick your haskell variables into javascript/coffeescript at compile time.

Safe HaskellNone

Text.Julius

Contents

Description

A Shakespearean module for Javascript templates, introducing type-safe, compile-time variable and url interpolation.-- To use this module, coffee must be installed on your system.

You might consider trying Coffee, which compiles down to Javascript.

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

Synopsis

Functions

Template-Reading Functions

These QuasiQuoter and Template Haskell methods return values of type JavascriptUrl url. See the Yesod book for details.

juliusFileDebug :: FilePath -> Q ExpSource

Deprecated: Please use juliusFileReload instead.

jsFileDebug :: FilePath -> Q ExpSource

Deprecated: Please use jsFileReload instead.

Datatypes

type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> JavascriptSource

Return type of template-reading functions.

newtype Javascript Source

Newtype wrapper of Builder.

Constructors

Javascript 

Instances

Typeclass for interpolated variables

class ToJavascript a whereSource

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

class RawJS a whereSource

Methods

rawJS :: a -> RawJavascriptSource

Rendering Functions

renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> TextSource

render with route interpolation. If using this module standalone, apart from type-safe routes, a dummy renderer can be used:

 renderJavascriptUrl (\_ _ -> undefined) javascriptUrl

When using Yesod, a renderer is generated for you, which can be accessed within the GHandler monad: getUrlRenderParams.

internal, used by Coffee

internal

juliusUsedIdentifiers :: String -> [(Deref, VarType)]Source

Determine which identifiers are used by the given template, useful for creating systems like yesod devel.