Hello,

I'm currently stuck trying to decode one portion of my model. The problem I 
have is the following:

The portion I'm trying to decode looks like this:

{
  ...
filter_type: "int",
data: {
   predicate: "less than",
   operand: 10
}
...
}

filter type can be one of (int,text,enum etc...)
I want to apply different decoders to data depending on the value of 
filter_type because both the predicate and  the operand vary depending on 
it. Actually, even the operand type can vary depending on the combination 
of filter_type and predicate (could be an int, a string, a list etc...).

In the end I'm trying to convert this json fragment into an ADT value. I've 
already coded the ADT which contains the filter_type,predicate and operand 
informations altogether however I can't find how to decode it from JSON.

Is there any way to change the decoder used on one or more fields based on 
the value of another field ?

Thanks.

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