@@ -273,12 +273,11 @@ qualifiedToJS _ f (Qualified _ a) = JSVar $ identToJs (f a)
273273bindersToJs :: (Functor m, Applicative m, Monad m) => Options -> ModuleName -> Environment -> [CaseAlternative] -> [JS] -> SupplyT m JS
274274bindersToJs opts m e binders vals = do
275275 valNames <- replicateM (length vals) freshName
276− let assignments = zipWith JSVariableIntroduction valNames (map Just vals)
277276 jss <- forM binders $ \(CaseAlternative bs grd result) -> do
278277 ret <- valueToJs opts m (bindNames m (concatMap binderNames bs) e) result
279278 go valNames [JSReturn ret] bs grd
280− return $ JSApp (JSFunction Nothing [] (JSBlock (assignments ++ concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")])))
281− []
279+ return $ JSApp (JSFunction Nothing valNames (JSBlock (concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")])))
280+ vals
282281 where
283282 go :: (Functor m, Applicative m, Monad m) => [String] -> [JS] -> [Binder] -> Maybe Guard -> SupplyT m [JS]
284283 go _ done [] Nothing = return done