kowainik / kowainik/stan

Advise to use newtypes in fields of same type

Open
#174 1 comment 1 reaction 0 assignees View on GitHub
essential :bread: inspection opt-in
Dominant language
Haskell
Stars
597
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Advice to use newtypes in data types with multiple fields with the same type:

```haskell
data Params = Params
{ height :: !Double -- ^ in cmeters
, weight :: !Double -- ^ in kgs
}
```

replace with

```haskell
data Params = Params
{ height :: !Cm
, weight :: !Kg
}

newtype Cm = {unCm :: Double}
newtype Kg = {unKg :: Double}
```

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by locating the analyzer logic for advice about data declarations and reviewing nearby checks and tests. Done should mean the analyzer can identify multiple fields sharing a type and advise distinct newtypes, with coverage for the Params-style example.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.