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 in other modules where destructuring does not change the type #8

Open
jfmengels opened this issue Sep 13, 2022 · 0 comments

Comments

@jfmengels
Copy link
Owner

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 if the outer function has a type signature, and the return type is the same as the type of the value, then there is no need to destructure the value.

module A exposing (..)
type A b = A String

-- should be simplified
xyz : A String
xyz = -- ...

-- Can be simplified
a : A String
a n = let (A b) = xyz
    in A b

This probably needs type inference to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant