on master help sign in
Fix how tuples are passed in and out of Elm
commitb0501a4a900fa4b9cf53afdc075534e4180ba168 authorEvan Czaplicki <info@elm-lang.org> dateWed 6 Apr 2016, 15:33 (11 years ago) parenta9bf350
1 file changed+7−1
src/Generate/JavaScript/Foreign.hs+7−1
src/Generate/JavaScript/Foreign.hs+7−1
@@ -194,8 +194,14 @@ toTuple types =
194194 let
195195 size =
196196 length types
197+
198+ args =
199+ map (\n -> 'x' : show n) [ 1 .. size ]
200+
201+ makeTuple =
202+ Opt.Function args (Opt.Data ("_Tuple" ++ show size) (map (Opt.Var . Var.local) args))
197203 in
198− to ("tuple" ++ show size) <== map decode types
204+ to ("tuple" ++ show size) <== (makeTuple : map decode types)
199205
200206
201207toRecord :: [(String, T.Canonical)] -> Opt.Expr