diff options
author | PhilFreeman <> | 2014-05-23 22:11:00 (GMT) |
---|---|---|
committer | hdiff <hdiff@hdiff.luite.com> | 2014-05-23 22:11:00 (GMT) |
commit | 402980bf3c30070fa1e91ce11b94d651ad5b34ea (patch) | |
tree | fb7a5daea6fc0a5e1730a07a6115379d412bf5ad | |
parent | 3e83f43466e99b1c6479b2e9bf14a6a379704c10 (diff) |
version 0.5.2.10.5.2.1
-rw-r--r-- | purescript.cabal | 2 | ||||
-rw-r--r-- | src/Language/PureScript/CodeGen/JS.hs | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/purescript.cabal b/purescript.cabal index 186add8..0317dc7 100644 --- a/purescript.cabal +++ b/purescript.cabal @@ -1,5 +1,5 @@ name: purescript -version: 0.5.2 +version: 0.5.2.1 cabal-version: >=1.8 build-type: Custom license: MIT diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs index e59d43f..0c37a64 100644 --- a/src/Language/PureScript/CodeGen/JS.hs +++ b/src/Language/PureScript/CodeGen/JS.hs @@ -273,12 +273,11 @@ qualifiedToJS _ f (Qualified _ a) = JSVar $ identToJs (f a) bindersToJs :: (Functor m, Applicative m, Monad m) => Options -> ModuleName -> Environment -> [CaseAlternative] -> [JS] -> SupplyT m JS bindersToJs opts m e binders vals = do valNames <- replicateM (length vals) freshName - let assignments = zipWith JSVariableIntroduction valNames (map Just vals) jss <- forM binders $ \(CaseAlternative bs grd result) -> do ret <- valueToJs opts m (bindNames m (concatMap binderNames bs) e) result go valNames [JSReturn ret] bs grd - return $ JSApp (JSFunction Nothing [] (JSBlock (assignments ++ concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")]))) - [] + return $ JSApp (JSFunction Nothing valNames (JSBlock (concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")]))) + vals where go :: (Functor m, Applicative m, Monad m) => [String] -> [JS] -> [Binder] -> Maybe Guard -> SupplyT m [JS] go _ done [] Nothing = return done |