elm.unionDecoder.mustache Maven / Gradle / Ivy
{{vendorExtensions.x-decoder}} : Decoder {{vendorExtensions.x-union-type}}
{{vendorExtensions.x-decoder}} =
Decode.string
|> Decode.andThen (\str ->
case str of
{{#allowableValues}}
{{#enumVars}}
{{{value}}} ->
Decode.succeed {{name}}
{{/enumVars}}
{{/allowableValues}}
other ->
Decode.fail <| "Unknown type: " ++ other
)