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

NoSimpleLetBody should report destructuring for named patterns where the type variable is not a phantom type #7

Open
jfmengels opened this issue Sep 13, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jfmengels
Copy link
Owner

jfmengels commented Sep 13, 2022

At the moment, the rule doesn't report the destructuring of single variant constructors when we don't know whether the type has any phantom types (as that could be the purpose of the destructuring).

This correctly doesn't get reported.

type A b = A String
a = let (A b) = xyz
    in A b

but the heuristic we use is to only check whether the type has type variables. We are not checking whether the type variable is actually a phantom one or not.

module A exposing (..)
type A b = A b
-- should be simplified
a = let (A b) = xyz
    in A b

There may some edge cases to figure out where this might be change things? For instance, what if the type is a phantom type by transition (used as a type variable to another type where it is a phantom type)? To be explored.

@jfmengels jfmengels added enhancement New feature or request help wanted Extra attention is needed labels Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant