@@ -1,5 +1,10 @@
11{-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
2+{- | This module re-exports the modules necessary for compiling Elm code into the
3+ respective HTML, JS and CSS code.
24
5+ It also provides a predefined generateHtml function for use with the Blaze markup library
6+ as well as a simple QuasiQuoter for embedding literal elm code in a Haskell file.
7+-}
38module Language.Elm (
49 module Language.Elm.Initialize,
510 module Language.Elm.CompileToJS,
@@ -15,8 +20,32 @@ import Language.Elm.GenerateHtml
1520import Language.Haskell.TH
1621import Language.Haskell.TH.Quote
1722
23+{- | This QuasiQuoter allows for literal embedding of elm source code within
24+ Haskell files. It is not responsible for the actual compilation Process.
25+ Usage:
26+
27+ @
28+ elmPage = [elm|
29+ main = image \"someImage.jpg\"
30+ |]
31+ @
32+
33+ How the elm code is compiled depends on how you intend to use it.
34+ Example uses are the included 'generateHtml' function as well as the
35+ "Language.Elm.Yesod" module.
36+-}
1837elm :: QuasiQuoter
1938elm = QuasiQuoter {quoteExp = \s -> [|s|] }
2039
40+{- | elmFile is a quoteFile wrapper around the 'elm' QuasiQuoter and allows for
41+ external elm source files to be embedded.
42+ Usage:
43+
44+ @
45+ [elmFile|elm-source/page.elm|]
46+ @
47+
48+ Please note that no spaces should be added before and after the filename.
49+-}
2150elmFile :: QuasiQuoter
2251elmFile = quoteFile elm