evancz/Elm — pull request #486 by JoeyEremondi (2014-02-01 07:07:45+00:00)
Title: Added Pretty instance for Module (3rd time's the charm)

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

I had two garbage PRs preceding this, one because of a stupid mistake and one because Travis CI didn't like that I still had an old commit with the mistake, even when I'd fixed the new one. My apologies for the noise.