collegevine / collegevine/purescript-whine

rule proposal: operator direction

Open
#1 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
PureScript
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Proposal template

```md
# Rule Proposal - <Slug>
<Short Description>

## Metrics

### Complexity
> _How complex (napkin math) is this rule to implement?_

|Low|Medium|High|
|--|--|--|
|x|||

### Cost of not enforcing
> _How much pain does checking this rule avoid?_

|Low|Medium|High|
|--|--|--|
|x|||

### Auto-Fix Value
> _How tedious is fixing this rule manually?_

|Low|Medium|High|
|--|--|--|
|||x|

### Bikeshed Coefficient
> _How contentious is this rule (with proposed configuration options)?_
> _Examples:_
> * _High bikeshed: `replace-if-with-case` that rejects all `if x then y else z` in favor of `case x of true -> y; false -> z`_
> * _Med bikeshed: `if-else` with config options for `prefer-if-then`, `prefer-guard`, `prefer-case`_
> * _Low bikeshed: `avoid-unsafe-coerce`_

|Low|Medium|High|
|--|--|--|
||x||

## Modes
> _Put configurable modes here as subheadings. If no configuration / only 1 mode, just use "Default."_

## Examples
> _For each configurable mode, provide at least 1 example of "do" and 1 of "don't do."_

### Foo
bar

## Rationale
> _Insert rant here_
```

# Rule Proposal - Operator Direction
Spot mixed-convention use of `$`/`#`, `<<<`/`>>>`, `<$>`/`<#>`

## Metrics

### Complexity
> _How complex (napkin math) is this rule to implement?_

|Low|Medium|High|
|--|--|--|
|||x|

### Cost of not enforcing
> _How much pain does checking this rule avoid?_

|Low|Medium|High|
|--|--|--|
|x|||

### Auto-Fix Value
> _How tedious is fixing this rule manually?_

|Low|Medium|High|
|--|--|--|
|||x|

### Bikeshed Coefficient
> _How contentious is this rule (with proposed configuration options)?_
> _Examples:_
> * _High bikeshed: `replace-if-with-case` that rejects all `if x then y else z` in favor of `case x of true -> y; false -> z`_
> * _Med bikeshed: `if-else` with config options for `prefer-if-then`, `prefer-guard`, `prefer-case`_
> * _Low bikeshed: `avoid-unsafe-coerce`_

|Low|Medium|High|
|--|--|--|
||x||

## Modes
> _Put configurable modes here as subheadings. If no configuration / only 1 mode, just use "Default."_
### `ltr`
Strongly prefer / dogmatically enforce `#`, `>>>`, `>>=`, `<#>`, etc.
### `rtl`
Strongly prefer / dogmatically enforce `$`, `<<<`, `=<<`, `<$>`, etc.
### `rtl-pure-ltr-monad`
Use `rtl` as default, unless expression contains `=<<` or `<=<`; then ltr for that expression

## Examples
> _For each configurable mode, provide at least 1 example of "do" and 1 of "don't do."_

### `ltr`
**Do**
```purs
myNum # Number.trunc # Int.toString # show
strMaybeNum # Number.fromString <#> Milliseconds >>= Instant.instant <#> Instant.toDateTime
```
**Don't**
```purs
show $ Int.toString $ Number.trunc $ myNum
Instant.toDateTime <$> (Instant.instant =<< Milliseconds <$> Number.fromString strMaybeNum)
```
### `rtl`
**Do**
```purs
show $ Int.toString $ Number.trunc $ myNum
Instant.toDateTime <$> (Instant.instant =<< Milliseconds <$> Number.fromString strMaybeNum)
```
**Don't**
```purs
myNum # Number.trunc # Int.toString # show
strMaybeNum # Number.fromString <#> Milliseconds >>= Instant.instant <#> Instant.toDateTime
```
### `rtl-pure-ltr-monad`

**Do**
```purs
show $ Int.toString $ Number.trunc $ myNum
strMaybeNum # Number.fromString <#> Milliseconds >>= Instant.instant <#> Instant.toDateTime
```
**Don't**
```purs
myNum # Number.trunc # Int.toString # show
Instant.toDateTime <$> (Instant.instant =<< Milliseconds <$> Number.fromString strMaybeNum)
```

## Rationale
> _Insert rant here_

Consistent style. Personal dogma is use regular composition / expression order (RTL) except for monadic expressions because bind & kleisli operators have low precedence, making you write **_parentheses_** 🤢

Also monadic expressions tend to have a more linear time-bound nature which lends better to LTR

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are identified in the issue. Review the proposed `ltr`, `rtl`, and `rtl-pure-ltr-monad` modes and their examples first; done would require an agreed implementation of the operator-direction rule, including its configuration behavior and checks.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.