-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.hlint.yaml
111 lines (91 loc) · 3.81 KB
/
.hlint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
- modules:
- {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
- {name: [Data.Map], as: Map}
- {name: [Syntax.Type], as: T}
- {name: [Syntax.Kind], as: K}
- {name: [Syntax.Expression], as: E}
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
- functions:
- {name: nub, within: []} # nub is O(n^2)
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# The hints are named by the string they display in warning messages.
# For example, if you see a warning starting like
#
# Main.hs:116:51: Warning: Redundant ==
#
# You can refer to that hint with `{name: Redundant ==}` (see below).
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}
# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
- ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Use &&"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Use ?~"}
- ignore: {name: "Use unless"}
# `T <= U` checks if `T` is a subtype `U`. Changing `not (T <= U)` might be
# possible but is very idiomatic in this context.
- ignore: {name: "Use >", within: AlgST.Typing}
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
- group:
name: default
enabled: true
imports:
- package base
rules:
# BIFUNCTOR
- warn: {lhs: bimap id g, rhs: second g}
- warn: {lhs: bimap f id, rhs: first f}
- warn: {lhs: first id, rhs: id}
- warn: {lhs: second id, rhs: id}
- warn: {lhs: bimap id id, rhs: id}
- warn: {lhs: first f (second g x), rhs: bimap f g x}
- warn: {lhs: second g (first f x), rhs: bimap f g x}
- warn: {lhs: first f (first g x), rhs: first (f . g) x}
- warn: {lhs: second f (second g x), rhs: second (f . g) x}
- warn: {lhs: bimap f h (bimap g i x), rhs: bimap (f . g) (h . i) x}
- warn: {lhs: first f (bimap g h x), rhs: bimap (f . g) h x}
- warn: {lhs: second g (bimap f h x), rhs: bimap f (g . h) x}
- warn: {lhs: bimap f h (first g x), rhs: bimap (f . g) h x}
- warn: {lhs: bimap f g (second h x), rhs: bimap f (g . h) x}
- hint: {lhs: "\\(x,y) -> (f x, g y)", rhs: Data.Bifunctor.bimap f g, note: IncreasesLaziness}
- hint: {lhs: "\\(x,y) -> (f x,y)", rhs: Data.Bifunctor.first f, note: IncreasesLaziness}
- hint: {lhs: "\\(x,y) -> (x,f y)", rhs: Data.Bifunctor.second f, note: IncreasesLaziness}
- hint: {lhs: "(f (fst x), g (snd x))", rhs: Data.Bifunctor.bimap f g x}
- hint: {lhs: "(f (fst x), snd x)", rhs: Data.Bifunctor.first f x}
- hint: {lhs: "(fst x, g (snd x))", rhs: Data.Bifunctor.second g x}
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml