evancz/Elm — pull request #485 by JoeyEremondi (2014-02-01 06:59:44+00:00)
Title: Add Pretty instance to SourceSyntax.Module

No substantial changes, just adding a Pretty instance declaration for Modules in the syntax tree.

The following file serves as a basic test case. It can be parsed, pretty-printed, re-parsed, then re-pretty printed, meaning the output of the pretty printer is syntactically valid in this case.

module Foo (getType, getCtor) where
import Y
import Json
import Dict as D

import open Transform2D

getType = \(Object d) -> case Dict.lookup "__type" d of
Just (Json.String t) -> t
getCtor = \(Object d) -> case Dict.lookup "__ctor" d of
Just (Json.String c) -> c
varNamed = \(Object d) n -> case Dict.lookup (show n) d of
Just val -> val
mapJson = \f (Array l) -> map f l
makeList = \(Array l) -> l
error = \s -> case True of False -> s