collegevine / collegevine/purescript-whine

rule proposal: explicit function application could be point-free

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

Description

# Rule Proposal - explicit function application could be point-free
This could be very complex or very simple. The simplest example is look for a cst pattern like
` a = a` and rule says "just do ` = ` bozo".

Does not account for some one-off cases like recursive typeclass instances;
```purs
class Foo a where
foo :: a -> String
foo2 :: a -> String

instance Foo String where
foo "" = ""
foo = foo2 <<< String.init
foo2 a = foo a -- necessary to compile
```

## 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._

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

### Default
**Do**
```purs
f = g
f = j <<< h <<< g
```
**Don't Do**
```purs
f a = g a
f a = j $ h $ g a
```

## Rationale
> _Insert rant here_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.