Popularity
4.9
Declining
Activity
0.0
Stable
7
4
1

Monthly Downloads: 4
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Language     Compiler     Elm    
Latest version: v0.14.0.0

elm-build-lib alternatives and similar packages

Based on the "elm" category.
Alternatively, view elm-build-lib alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of elm-build-lib or a related project?

Add another 'elm' Package

README

elm-build-lib

A library for compiling Elm to JavaScript from within Haskell

This library provides both runtime and Template Haskell functions which let you take multi-module Elm Programs and compile them to JavaScript. The main goal of this is to allow Elm to be used as a frontend for Haskell servers or Web apps. The library is independent of any specific framework, so it should work with Yesod, Snap, Happstack, Scotty, etc.

You can find this package on Hackage.

Examples

Compiling to a single JS file

import Language.Elm.Build

mainSource = "module Main where\nx=3"
fooSource = "module Foo where\nx=3"

myJS :: String
myJS = compileAndLinkAll [mainSource, fooSource]

Of course, you can load the elm source from a file, or use a nicer multi-line string library such as QuasiText.

The order you give the modules in does not matter.

Compiling to a single JS file, during Haskell compilation

import Language.Elm.Build

mainSource = "module Main where\nx=3"
fooSource = "module Foo where\nx=3"

myJS :: String
myJS = $(deriveElmJS [mainSource, fooSource])

This uses TemplateHaskell to do the Elm->JS conversion when Haskell compiles, so that you don't recompile your code every time you serve its JavaScript.