on master help sign in
Get the haskell library working
commit2c96bf0c3347d812ffeee210a2c9b2dbea1980e6 authorEvan Czaplicki <info@elm-lang.org> dateWed 31 Jul 2013, 09:31 (13 years ago) parente677f27
2 files changed+75−98
Elm.cabal+73−97 compiler/Language/Elm.hs+2−1
Elm.cabal+73−97
@@ -29,72 +29,73 @@ source-repository head
2929 type: git
3030 location: git://github.com/evancz/Elm.git
3131
32−--Library
33−-- exposed-modules: Language.Elm,
34−-- Language.Elm.Quasi
35−-- Hs-Source-Dirs: compiler
36−-- other-modules: Unique,
37−-- SourceSyntax.Declaration,
38−-- SourceSyntax.Expression,
39−-- SourceSyntax.Everything,
40−-- SourceSyntax.Helpers,
41−-- SourceSyntax.Literal,
42−-- SourceSyntax.Location,
43−-- SourceSyntax.Module,
44−-- SourceSyntax.Pattern,
45−-- SourceSyntax.Type,
46−-- Generate.JavaScript,
47−-- Generate.Noscript,
48−-- Generate.Html,
49−-- Generate.Cases,
50−-- Transform.Canonicalize,
51−-- Transform.Substitute,
52−-- Transform.Optimize,
53−-- Metadata.Prelude,
54−-- Initialize,
55−-- Parse.Binop,
56−-- Parse.Declaration,
57−-- Parse.Expression,
58−-- Parse.Helpers,
59−-- Parse.Literal,
60−-- Parse.Module,
61−-- Parse.Parse,
62−-- Parse.Pattern,
63−-- Parse.Type,
64−-- Type.Constrain.Declaration,
65−-- Type.Constrain.Expression,
66−-- Type.Constrain.Literal,
67−-- Type.Constrain.Pattern,
68−-- Type.Environment,
69−-- Type.Fragment,
70−-- Type.Solve,
71−-- Type.State,
72−-- Type.Type,
73−-- Type.Unify,
74−-- Paths_Elm
75−--
76−-- Build-depends: base >=4.2 && <5,
77−-- binary,
78−-- blaze-html == 0.5.* || == 0.6.*,
79−-- blaze-markup == 0.5.1.*,
80−-- bytestring,
81−-- cmdargs,
82−-- containers >= 0.3,
83−-- deepseq,
84−-- directory,
85−-- filepath,
86−-- hjsmin,
87−-- indents,
88−-- mtl >= 2,
89−-- pandoc >= 1.10,
90−-- parsec >= 3.1.1,
91−-- pretty,
92−-- shakespeare,
93−-- text,
94−-- template-haskell,
95−-- transformers >= 0.2,
96−-- union-find,
97−-- uniplate
32+Library
33+ exposed-modules: Language.Elm,
34+ Language.Elm.Quasi
35+ Hs-Source-Dirs: compiler
36+ other-modules: Unique,
37+ SourceSyntax.Declaration,
38+ SourceSyntax.Expression,
39+ SourceSyntax.Everything,
40+ SourceSyntax.Helpers,
41+ SourceSyntax.Literal,
42+ SourceSyntax.Location,
43+ SourceSyntax.Module,
44+ SourceSyntax.Pattern,
45+ SourceSyntax.Type,
46+ Generate.JavaScript,
47+ Generate.Noscript,
48+ Generate.Html,
49+ Generate.Cases,
50+ Transform.Canonicalize,
51+ Transform.SortDefinitions,
52+ Transform.Substitute,
53+ Transform.Optimize,
54+ Metadata.Prelude,
55+ Initialize,
56+ Parse.Binop,
57+ Parse.Declaration,
58+ Parse.Expression,
59+ Parse.Helpers,
60+ Parse.Literal,
61+ Parse.Module,
62+ Parse.Parse,
63+ Parse.Pattern,
64+ Parse.Type,
65+ Type.Constrain.Declaration,
66+ Type.Constrain.Expression,
67+ Type.Constrain.Literal,
68+ Type.Constrain.Pattern,
69+ Type.Environment,
70+ Type.Fragment,
71+ Type.Solve,
72+ Type.State,
73+ Type.Type,
74+ Type.Unify,
75+ Paths_Elm
76+
77+ Build-depends: base >=4.2 && <5,
78+ binary,
79+ blaze-html == 0.5.* || == 0.6.*,
80+ blaze-markup == 0.5.1.*,
81+ bytestring,
82+ cmdargs,
83+ containers >= 0.3,
84+ deepseq,
85+ directory,
86+ filepath,
87+ hjsmin,
88+ indents,
89+ mtl >= 2,
90+ pandoc >= 1.10,
91+ parsec >= 3.1.1,
92+ pretty,
93+ shakespeare,
94+ text,
95+ template-haskell,
96+ transformers >= 0.2,
97+ union-find,
98+ uniplate
9899
99100Executable elm
100101 Main-is: Compiler.hs
@@ -114,6 +115,7 @@ Executable elm
114115 Generate.Html,
115116 Generate.Cases,
116117 Transform.Canonicalize,
118+ Transform.SortDefinitions,
117119 Transform.Substitute,
118120 Transform.Optimize,
119121 Metadata.Prelude,
@@ -159,34 +161,8 @@ Executable elm
159161 union-find,
160162 uniplate
161163
162−--Executable elm-doc
163−-- Main-is: Docs.hs
164−-- Hs-Source-Dirs: compiler
165−-- other-modules: SourceSyntax.Helpers,
166−-- SourceSyntax.Location,
167−-- SourceSyntax.Literal,
168−-- SourceSyntax.Pattern,
169−-- SourceSyntax.Expression,
170−-- SourceSyntax.Declaration,
171−-- SourceSyntax.Module,
172−-- Parse.Helpers,
173−-- Parse.Module
174−--
175−-- Build-depends: base >=4.2 && <5,
176−-- binary,
177−-- containers >= 0.3,
178−-- transformers >= 0.2,
179−-- mtl >= 2,
180−-- parsec >= 3.1.1,
181−-- pandoc >= 1.10,
182−-- pretty,
183−-- cmdargs,
184−-- filepath,
185−-- union-find,
186−-- indents
187−
188−--Test-Suite test-elm
189−-- Type: exitcode-stdio-1.0
190−-- Hs-Source-Dirs: tests
191−-- Main-is: Everything.hs
192−-- build-depends: base
164+Test-Suite test-elm
165+ Type: exitcode-stdio-1.0
166+ Hs-Source-Dirs: tests
167+ Main-is: Everything.hs
168+ build-depends: base
compiler/Language/Elm.hs+2−1
@@ -23,13 +23,14 @@ import SourceSyntax.Module
2323import Text.Blaze.Html (Html)
2424import Text.Parsec (option,optional)
2525import qualified Text.PrettyPrint as P
26+import qualified Metadata.Prelude as Prelude
2627import Paths_Elm
2728
2829-- |This function compiles Elm code to JavaScript. It will return either
2930-- an error message or the compiled JS code.
3031compile :: String -> Either String String
3132compile source =
32− case buildFromSource Map.empty source of
33+ case buildFromSource False Prelude.interfaces source of
3334 Left docs -> Left . unlines $ map P.render docs
3435 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
3536