Stan 0206 should not fire for type data
- Dominant language
- Haskell
- Stars
- 597
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
I have this code:
```haskell
{-# LANGUAGE TypeData #-}
infixr :->
type data PCFType = PCFType :-> PCFType | Nat
```
And Stan reports:
```
✲ Name: Data types with non-strict fields
✲ Description: Defining lazy fields in data types can lead to unexpected space leaks
✲ Severity: Performance
✲ Category: #SpaceLeak #Syntax
Possible solutions:
- Add '!' before the type, e.g. !Int or !(Maybe Bool)
- Enable the 'StrictData' extension: {-# LANGUAGE StrictData #-}
stan(STAN-0206)
```
But strictness fields are not allowed in `type data` declarations.
Contributor guide
Research direction
Start by reproducing the Haskell snippet with the TypeData extension and confirming the STAN-0206 report. Trace the STAN-0206 implementation and its tests, then ensure type data declarations are excluded from the non-strict-field warning while ordinary data declarations retain the existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100