1{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
2{- | This module exports the functions necessary for compiling Elm code into the
3 respective HTML, JS and CSS code.
5 The type class @'ElmSource'@ requires an instance for all types that the Elm
6 compiler understands. The provided instances for String, Text and QuasiQuoted
7 Elm source code should be sufficient.
9 The documentation for the Elm language is available at
10 <http://elm-lang.org/Documentation.elm>, and many interactive examples are
11 available at <http://elm-lang.org/Examples.elm>
13 Example implementations using Yesod and Happstack are available
14 at <https://github.com/tazjin/Elm/tree/master/Examples>
21import Data.Version (showVersion)
26import Text.Blaze.Html (Html)
27import Language.Elm.Quasi
30import qualified Data.Text as TS
31import qualified Data.Text.Lazy as TL
33-- |This function compiles Elm code to three separate parts: HTML, CSS,
34-- and JavaScript. The HTML is only the contents of the body, so the three
35-- parts must be combined in a basic HTML skeleton.
36compile :: String -> String
37compile source = either showErr jsModule modul
38 where modul = buildFromSource source
40-- |This function compiles Elm code into a full HTML page.
41toHtml :: String -- ^ Location of elm-min.js as expected by the browser
42 -> String -- ^ The page title
43 -> String -- ^ The elm source code
47-- |The absolute path to Elm's runtime system.
48runtimeLocation :: IO FilePath
49runtimeLocation = getDataFileName "elm-runtime.js"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list