File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` UnusedName ` Warning
2+
3+ ## Example
4+
5+ ``` purescript
6+ module UnusedNameExample where
7+
8+ plus :: Int -> Int -> Int
9+ plus x y = y -- Name x was introduced but not used.
10+
11+ ignore :: forall a. a -> Unit
12+ ignore value = unit -- Name value was introduced but not used.
13+ ```
14+
15+ ## Cause
16+
17+ This warning occurs when a name is introduced but is not used anywhere.
18+
19+ PureScript warns in this case because it could indicate a bug due to a value not being referenced where it should be.
20+
21+ ## Fix
22+
23+ If the unused name was unintentional, make use of it to fix the warning:
24+
25+ ``` purescript
26+ plus :: Int -> Int -> Int
27+ plus x y = x + y
28+ ```
29+
30+ If the unused name is intentional, mark the name as unused by prefixing it with a ` _ ` :
31+
32+ ``` purescript
33+ ignore :: forall a. a -> Unit
34+ ignore _value = unit
35+ ```
36+
37+ ## Notes
You can’t perform that action at this time.
0 commit comments