kowainik / kowainik/stan

Stan 0206 should not fire for type data

Open
#544 3 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.