type alias Car =
  { numberOfDoors: Int
  }

type alias Plane =
  { maxSpeed: Int
  }

type Transport = Walk
  | Ride Car
  | Fly Plane

Could be encoded as [name, encoded] or just [name] if it's only an 
identifier without a value.
So they would be encoded as

['Walk']

or

['Ride', {
  numberOfDoors: 4
}]

or ['Fly', {
  maxSpeed: 1000
}]

fredag 3. mars 2017 17.18.02 UTC+1 skrev Rupert Smith følgende:
>
> On Friday, March 3, 2017 at 3:29:34 PM UTC, Peter Damoc wrote:
>>
>> It makes sense to focus on other issues that are more important BUT, 
>> people are having enough troubles with boilerplate introduced by decoders 
>> that this could easily be considered a priority. 
>>
>
> +1 from me, just for the convenience of being able to do it.
>
> What would the default mapping for a union type to json looks like? 
>

-- 
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.

Reply via email to