on master help sign in
Get the haskell library working
2c96bf0Evan Czaplicki
Elm.cabal+73−97
@@ -29,72 +29,73 @@ source-repository head
29 type: git
29 type: git
30 location: git://github.com/evancz/Elm.git
30 location: git://github.com/evancz/Elm.git
31
31
32−--Library
32+Library
33−-- exposed-modules: Language.Elm,
33+ exposed-modules: Language.Elm,
34−-- Language.Elm.Quasi
34+ Language.Elm.Quasi
35−-- Hs-Source-Dirs: compiler
35+ Hs-Source-Dirs: compiler
36−-- other-modules: Unique,
36+ other-modules: Unique,
37−-- SourceSyntax.Declaration,
37+ SourceSyntax.Declaration,
38−-- SourceSyntax.Expression,
38+ SourceSyntax.Expression,
39−-- SourceSyntax.Everything,
39+ SourceSyntax.Everything,
40−-- SourceSyntax.Helpers,
40+ SourceSyntax.Helpers,
41−-- SourceSyntax.Literal,
41+ SourceSyntax.Literal,
42−-- SourceSyntax.Location,
42+ SourceSyntax.Location,
43−-- SourceSyntax.Module,
43+ SourceSyntax.Module,
44−-- SourceSyntax.Pattern,
44+ SourceSyntax.Pattern,
45−-- SourceSyntax.Type,
45+ SourceSyntax.Type,
46−-- Generate.JavaScript,
46+ Generate.JavaScript,
47−-- Generate.Noscript,
47+ Generate.Noscript,
48−-- Generate.Html,
48+ Generate.Html,
49−-- Generate.Cases,
49+ Generate.Cases,
50−-- Transform.Canonicalize,
50+ Transform.Canonicalize,
51+ Transform.SortDefinitions,
51−-- Transform.Substitute,
52+ Transform.Substitute,
52−-- Transform.Optimize,
53+ Transform.Optimize,
53−-- Metadata.Prelude,
54+ Metadata.Prelude,
54−-- Initialize,
55+ Initialize,
55−-- Parse.Binop,
56+ Parse.Binop,
56−-- Parse.Declaration,
57+ Parse.Declaration,
57−-- Parse.Expression,
58+ Parse.Expression,
58−-- Parse.Helpers,
59+ Parse.Helpers,
59−-- Parse.Literal,
60+ Parse.Literal,
60−-- Parse.Module,
61+ Parse.Module,
61−-- Parse.Parse,
62+ Parse.Parse,
62−-- Parse.Pattern,
63+ Parse.Pattern,
63−-- Parse.Type,
64+ Parse.Type,
64−-- Type.Constrain.Declaration,
65+ Type.Constrain.Declaration,
65−-- Type.Constrain.Expression,
66+ Type.Constrain.Expression,
66−-- Type.Constrain.Literal,
67+ Type.Constrain.Literal,
67−-- Type.Constrain.Pattern,
68+ Type.Constrain.Pattern,
68−-- Type.Environment,
69+ Type.Environment,
69−-- Type.Fragment,
70+ Type.Fragment,
70−-- Type.Solve,
71+ Type.Solve,
71−-- Type.State,
72+ Type.State,
72−-- Type.Type,
73+ Type.Type,
73−-- Type.Unify,
74+ Type.Unify,
74−-- Paths_Elm
75+ Paths_Elm
75−--
76+
76−-- Build-depends: base >=4.2 && <5,
77+ Build-depends: base >=4.2 && <5,
77−-- binary,
78+ binary,
78−-- blaze-html == 0.5.* || == 0.6.*,
79+ blaze-html == 0.5.* || == 0.6.*,
79−-- blaze-markup == 0.5.1.*,
80+ blaze-markup == 0.5.1.*,
80−-- bytestring,
81+ bytestring,
81−-- cmdargs,
82+ cmdargs,
82−-- containers >= 0.3,
83+ containers >= 0.3,
83−-- deepseq,
84+ deepseq,
84−-- directory,
85+ directory,
85−-- filepath,
86+ filepath,
86−-- hjsmin,
87+ hjsmin,
87−-- indents,
88+ indents,
88−-- mtl >= 2,
89+ mtl >= 2,
89−-- pandoc >= 1.10,
90+ pandoc >= 1.10,
90−-- parsec >= 3.1.1,
91+ parsec >= 3.1.1,
91−-- pretty,
92+ pretty,
92−-- shakespeare,
93+ shakespeare,
93−-- text,
94+ text,
94−-- template-haskell,
95+ template-haskell,
95−-- transformers >= 0.2,
96+ transformers >= 0.2,
96−-- union-find,
97+ union-find,
97−-- uniplate
98+ uniplate
98
99
99Executable elm
100Executable elm
100 Main-is: Compiler.hs
101 Main-is: Compiler.hs
@@ -114,6 +115,7 @@ Executable elm
114 Generate.Html,
115 Generate.Html,
115 Generate.Cases,
116 Generate.Cases,
116 Transform.Canonicalize,
117 Transform.Canonicalize,
118+ Transform.SortDefinitions,
117 Transform.Substitute,
119 Transform.Substitute,
118 Transform.Optimize,
120 Transform.Optimize,
119 Metadata.Prelude,
121 Metadata.Prelude,
@@ -159,34 +161,8 @@ Executable elm
159 union-find,
161 union-find,
160 uniplate
162 uniplate
161
163
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
164+Test-Suite test-elm
189−-- Type: exitcode-stdio-1.0
165+ Type: exitcode-stdio-1.0
190−-- Hs-Source-Dirs: tests
166+ Hs-Source-Dirs: tests
191−-- Main-is: Everything.hs
167+ Main-is: Everything.hs
192−-- build-depends: base
168+ build-depends: base
compiler/Language/Elm.hs+2−1
@@ -23,13 +23,14 @@ import SourceSyntax.Module
23import Text.Blaze.Html (Html)
23import Text.Blaze.Html (Html)
24import Text.Parsec (option,optional)
24import Text.Parsec (option,optional)
25import qualified Text.PrettyPrint as P
25import qualified Text.PrettyPrint as P
26+import qualified Metadata.Prelude as Prelude
26import Paths_Elm
27import Paths_Elm
27
28
28-- |This function compiles Elm code to JavaScript. It will return either
29-- |This function compiles Elm code to JavaScript. It will return either
29-- an error message or the compiled JS code.
30-- an error message or the compiled JS code.
30compile :: String -> Either String String
31compile :: String -> Either String String
31compile source =
32compile source =
32− case buildFromSource Map.empty source of
33+ case buildFromSource False Prelude.interfaces source of
33 Left docs -> Left . unlines $ map P.render docs
34 Left docs -> Left . unlines $ map P.render docs
34 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
35 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
35
36