kowainik / stan

🕵️ Haskell STatic ANalyser
https://kowainik.github.io/projects/stan
Mozilla Public License 2.0
562 stars 48 forks source link

STAN-0302 is triggered on long contexts #505

Open cdsmith opened 1 year ago

cdsmith commented 1 year ago

The following code:

type Differentiable f =
  ( Functor f,
    GenericK f,
    GDifferentiable (RepK f),
    GBifunctor (GDiff (RepK f))
  )

triggers this message from stan in HLS:

 ✲ Name:        Big tuples
 ✲ Description: Using tuples of big size (>= 4) can decrease code readability
 ✲ Severity:    Style
 ✲ Category:    #AntiPattern #Syntax
Possible solutions:
  - Consider defining and using a custom data type to improve code comprehension
stan(STAN-0302)

However, this is not a tuple. It is a context, and there is no way to define a custom data type to improve code comprehension.

tomjaguarpaw commented 8 months ago

I agree this is a bug. Unfortunately stan does not have an active enough maintainership to tackle anything beyond keeping the project building. If you (or anyone) can work out how to fix this (and add a test) then I'll happily incorporate it.

I suppose the correct thing to do is to disable the check for big tuples if we're to the left of a =>.

tomjaguarpaw commented 6 months ago

I don't know for certain, but possibly the fix to this issue will be similar to the fix for https://github.com/kowainik/stan/issues/544