On Friday, March 3, 2017 at 4:35:00 PM UTC, Eirik Sletteberg wrote:
>
> type alias Car =
>   { numberOfDoors: Int
>   }
>
> type alias Plane =
>   { maxSpeed: Int
>   }
>
> type Transport = Walk
>   | Ride Car
>   | Fly Plane
>

Or could be mapped to something that can be described with a json-schema 
enum for each 'tag' in the union type:

{ _type: "Walk" }

{ _type: "Ride"
, fields : [ {numberOfDoors: 1} ]
}

{ _type: "Fly"
, fields: [ { maxSpeed: 100 } ]
}

Where 'fields' is a list of the constructor arguments. Would be nice if I 
could always find a 1:1 mapping between the Elm type and a json-schema.


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