on master help sign in
Fix how tuples are passed in and out of Elm
b0501a4Evan Czaplicki
src/Generate/JavaScript/Foreign.hs+7−1
@@ -194,8 +194,14 @@ toTuple types =
194 let
194 let
195 size =
195 size =
196 length types
196 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))
197 in
203 in
198− to ("tuple" ++ show size) <== map decode types
204+ to ("tuple" ++ show size) <== (makeTuple : map decode types)
199
205
200
206
201toRecord :: [(String, T.Canonical)] -> Opt.Expr
207toRecord :: [(String, T.Canonical)] -> Opt.Expr