faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

Pattern matching in let statetments #434

Closed henrylaxen closed 9 years ago

henrylaxen commented 9 years ago

When I compile:

test :: [a] -> Fay ()
test as = do
  let
    (a1:a2) = as
  return ()

with fay test.hs

I get: fay: Fay bug! Can't compile pat bind for: [JsVar (JsTmp 1) (JsApp (JsName JsForce) [JsName (JsTmp 1)]) ,JsIf (JsInstanceOf (JsName (JsTmp 1)) (JsBuiltIn (Ident () "Cons"))) [JsVar (JsNameVar (UnQual () (Id ent () "a1"))) (JsGetProp (JsName (JsTmp 1)) (JsNameVar (UnQual () (Ident () "car")))),JsVar (JsNameVa r (UnQual () (Ident () "a2"))) (JsGetProp (JsName (JsTmp 1)) (JsNameVar (UnQual () (Ident () "cdr")))) ] []]

bergmark commented 9 years ago

Thanks for the report, and big thanks to @cdparks for fixing it! I released this as fay-0.23.1.7.