summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2014-01-10 23:07:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-01-10 23:07:00 (GMT)
commitb613dc6ec6edfc84e95fc62f4d4858153a1c8d41 (patch)
treeeddd75b01cea6015fa219cf0ae4f623ba9f5ff92
parent2b5b2a434d935e9fa97fb1582e9c759cedda9bbd (diff)
version 0.2.10.20.2.10.2
-rw-r--r--purescript.cabal2
-rw-r--r--src/Language/PureScript.hs2
-rw-r--r--src/Language/PureScript/CodeGen/JS.hs3
3 files changed, 4 insertions, 3 deletions
diff --git a/purescript.cabal b/purescript.cabal
index 3d5cb4b..825e3d8 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.2.10.1
+version: 0.2.10.2
cabal-version: >=1.8
build-type: Simple
license: MIT
diff --git a/src/Language/PureScript.hs b/src/Language/PureScript.hs
index 07716ee..a104c02 100644
--- a/src/Language/PureScript.hs
+++ b/src/Language/PureScript.hs
@@ -33,6 +33,6 @@ compile :: Options -> [Module] -> Either String (String, String, Environment)
compile opts ms = do
desugared <- desugar ms
(_, env) <- runCheck $ forM_ desugared $ \(Module moduleName decls) -> typeCheckAll (ModuleName moduleName) decls
- let js = prettyPrintJS . map (optimize opts) . concatMap (flip (moduleToJs opts) env) $ desugared
+ let js = prettyPrintJS . concatMap (flip (moduleToJs opts) env) $ desugared
let exts = intercalate "\n" . map (flip moduleToPs env) $ desugared
return (js, exts, env)
diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs
index ea4a3c2..1765dda 100644
--- a/src/Language/PureScript/CodeGen/JS.hs
+++ b/src/Language/PureScript/CodeGen/JS.hs
@@ -33,13 +33,14 @@ import Language.PureScript.CodeGen.Monad
import Language.PureScript.Options
import Language.PureScript.CodeGen.JS.AST as AST
import Language.PureScript.Types
+import Language.PureScript.CodeGen.Optimize
moduleToJs :: Options -> Module -> Environment -> [JS]
moduleToJs opts (Module pname@(ProperName name) decls) env =
mapMaybe filterRawDecls decls ++
[ JSVariableIntroduction (Ident name) Nothing
, JSApp (JSFunction Nothing [Ident name]
- (JSBlock (concat $ mapMaybe (\decl -> declToJs opts (ModuleName pname) decl env) decls)))
+ (JSBlock (concat $ mapMaybe (\decl -> fmap (map $ optimize opts) $ declToJs opts (ModuleName pname) decl env) decls)))
[JSAssignment (JSAssignVariable (Ident name))
(JSBinary Or (JSVar (Ident name)) (JSObjectLiteral []))]
]