Skip to content

exercism/elm-representer

Repository files navigation

Elm Representer

This outputs a normalized representation of Elm Code, to make automated analysis easier within Exercism.

Thanks to Elm Platform Worker Example for the initial template.

Install

npm install

Build

To compile the representer code, you can run elm make --optimize src/Main.elm --output=src/main.js in your terminal. Alternatively, you can simply use the following npm script, configured in the package.json file.

npm run make

If the code requires the Debug module (which it currently doesn't), use instead npm run make-debug that remove the --optimize from the command.

Usage

To normalise a file (bob.elm) and save normalized code to bob-normalized.elm and identifier mapping to mapping.json

cat bob.elm | node src/cli.js mapping.json > bob-normalized.elm

To normalize all the example files in this repo

sh normalize-examples.sh

Test

elm-test

Docker

This repo also contains the Docker configuration for integration with Exercism.

To normalise an Exercism solution using a Docker container:

# Mac / Linux
./bin/run-in-docker.sh bob /PathToThisRepo/example-bob-solution/ /PathToThisRepo/example-output/
# Windows
./bin/run-in-docker.ps1 bob /PathToThisRepo/example-bob-solution/ /PathToThisRepo/example-output/