Hello, 

I seem unable to pattern match on this nested union. Here is the relevant 
code. The try it function is just here to test if the FIlterType union 
works (which doesn't seem to be the case so far)
type FilterType = TypeInt NumberFilter Int | TypeFloat NumberFilter Float | 
TypeDate DateFilter | TypeEnum EnumFilter | TypeBool BoolFilter 
    | TypeGroupBy Int | TypeFiles TextFilter | TypeText TextFilter

type NumberFilter number= NumberIsEmpty  | NumberIsNotEmpty | NumberIs 
number | NumberIsNot number | NumberLessThan number | NumberGreaterThan 
number 
    | NumberLessOrEqualThan number | NumberGreaterOrEqualThan number | 
NumberGroupMinimum | NumberGroupMaximum
    | NumberGroupLowest Int | NumberGroupHighest Int

tryIt : FilterType -> Bool
tryIt ft = 
    case ft of
        TypeText f -> processTextFilter f (Just "toto")
        TypeFiles f -> processTextFilter f (Just "titi")
        TypeInt f o -> 
            case f of
                NumberIs _ -> o==2  -- This is the error line
                NumberIsNot _ -> o/=2
                NumberIsEmpty -> False
                _ -> False
        _ -> False

I run into this compilation error:

==== error in src/Model/Filter.elm:66:17: ====
Tag `Model.Filter.NumberIs` is causing problems in this pattern match.
This pattern matches things of type:
    NumberFilter
But the values it will actually be trying to match are:
    NumberFilter number

I'm confused. I have tried quite a few variations but none of them work.

Any ideas ?

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