Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type inference error when using a generic type alias #689

Closed
jmbockhorst opened this issue Apr 6, 2022 · 0 comments · Fixed by #955
Closed

Type inference error when using a generic type alias #689

jmbockhorst opened this issue Apr 6, 2022 · 0 comments · Fixed by #955
Assignees
Labels
bug Something isn't working type inference Related to type inference
Milestone

Comments

@jmbockhorst
Copy link
Member

RangeFilterData is getting bound to RangeFilterData Float and then failing when trying to decode for a date.

case ... of 
    "NumericRangeFilter" ->
        (Decode.succeed RangeFilterData
            |> required "min" (Decode.nullable Decode.float)
            |> required "max" (Decode.nullable Decode.float)
        )
            |> Decode.map NumericRangeFilter

    "DateRangeFilter" ->
        (Decode.succeed RangeFilterData
            |> required "min" (Decode.nullable dateDecoder)
            |> required "max" (Decode.nullable dateDecoder)
        )
            |> Decode.map DateRangeFilter


type alias RangeFilterData data =
    { min : Maybe data
    , max : Maybe data
    }

type FilterType
    = NumericRangeFilter (RangeFilterData Float)
    | DateRangeFilter (RangeFilterData Date)

@jmbockhorst jmbockhorst self-assigned this May 12, 2022
@jmbockhorst jmbockhorst added bug Something isn't working type inference Related to type inference labels May 12, 2022
@jmbockhorst jmbockhorst added this to the 2.7 milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type inference Related to type inference
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant