On Wed, Sep 28, 2016 at 5:34 PM, Kasey Speakman <[email protected]>
wrote:
> In the longer term, the solution that jumps out at me is the compiler
> could generate decoders for marked type aliases automatically. (I assume
> ports work this way already.) And decoding is still there for fuzzy
> scenarios.
>
That sounds like a neat idea. I'm trying to imagine how it would be
implemented. Would you pass a type in to a decode function? e.g.
``elm
type alias User =
{ name : String
, email : String
, birthday : Date
, id : Int
}
user1Json = """[
{"name": "Duane", "email": "[email protected]", "birthday":
"19800101T000000Z", id: 42},
{"name": "Kasey Speakman", "email": "[email protected]", "birthday":
"19810202T000000Z", id: 43}
]"""
```
-- the following is currently invalid Elm
user1 = decode(List User, user1Json)
```
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.