Closed zwilias closed 6 years ago
Thanks, @zwilias!
@halohalospecial Hm, you do need the index
thing, still ;)
Nice catch! Thanks again!
Two things:
I noticed that while you can enable/disable all sorts of autocomplete options in the settings, Decoders/Encoders are not among them.
It seems to assume that the Json.Decode
module (or replacement) is imported as Decoder
. It's more normal (afaik) to import it as Decode
, and that's what I do. So I have to manually change (or F&R) every part of the generated code mentioning Decoders.
The same thing seems to apply to Encoders - which puzzlingly assumes Json.Encode
is imported as Value
. I guess we like import
ing things as
their primary types or something?
Okay, three things.
Follow up from Slack discussion.
Generating decoders is wicked cool!
The one for tuples is a little weird, though - it's a little more idiomatic to use
Decode.map3 (,,) (Decode.index 0 ..) (Decode.index 1 ..) (Decode.index 2 ..)
rather than a series of nestedandThen
's.I also mentioned something about
andMap
, but I've thought about this a little more and think is may be a bad idea. Encouraging people to use pipeline is probably a better idea than usingandMap
pipelines.