mirror of
https://github.com/ilyakooo0/elm-bridge.git
synced 2024-09-11 14:05:55 +03:00
Properly encode dictionnaries with string index
This commit is contained in:
parent
0856922e8c
commit
a18ab729e8
@ -177,6 +177,7 @@ jsonSerForType' omitnull ty =
|
||||
then jsonSerForType t'
|
||||
else "(maybeEncode (" ++ jsonSerForType t' ++ "))"
|
||||
ETyApp (ETyCon (ETCon "Set")) t' -> "(encodeSet " ++ jsonSerForType t' ++ ")"
|
||||
ETyApp (ETyApp (ETyCon (ETCon "Dict")) (ETyCon (ETCon "String"))) value -> "(Json.Encode.dict identity (" ++ jsonSerForType value ++ "))"
|
||||
ETyApp (ETyApp (ETyCon (ETCon "Dict")) key) value -> "(encodeMap (" ++ jsonSerForType key ++ ") (" ++ jsonSerForType value ++ "))"
|
||||
_ ->
|
||||
case unpackTupleType ty of
|
||||
|
@ -64,7 +64,7 @@ moduleCode elmVersion = unlines
|
||||
, " , (\"blablub\", Json.Encode.int val.blablub)"
|
||||
, " , (\"tuple\", (\\(t1,t2) -> Json.Encode.list identity [(Json.Encode.int) t1,(Json.Encode.string) t2]) val.tuple)"
|
||||
, " , (\"list\", (Json.Encode.list Json.Encode.bool) val.list)"
|
||||
, " , (\"list_map\", (Json.Encode.list (encodeMap (Json.Encode.string) (Json.Encode.bool))) val.list_map)"
|
||||
, " , (\"list_map\", (Json.Encode.list (Json.Encode.dict identity (Json.Encode.bool))) val.list_map)"
|
||||
, " ]"
|
||||
, ""
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user