-
Notifications
You must be signed in to change notification settings - Fork 0
HLint
Louis Kueh edited this page Nov 6, 2018
·
12 revisions
The general syntax is lhs -- rhs with lhs being the expression you expect to be rewritten as rhs.
The absence of rhs means you expect no hints to fire. In addition ??? lets you assert a warning without a particular suggestion, while @ tags require a specific severity -- both these features are used less commonly.
-
Improve code and teach author better style. Doing modifications one by one individually improves style.
-
Display semantically changing hints
-
Severity
- Error - parse error
- warning -
concat (map f x ) => concatMap f x - suggestion - worthwhile but not to be applied blindly
-
Ignore/suppress hints based on user input, as hints do not always make sen
- bracket reduction only (e.g.
(foo) => foo) - imports =>
import A(B); import A(C) = import A(B,C)
Concept: Remove all the lambdas you can be inserting only sections Never create a right section with +-# as the operator (they are misparsed) Rules:
fun a = \x -> y -- promote lambdas, provided no where's outside the lambda
fun x = y x -- eta reduce, x /= mr and foo /= symbol
\x -> y x -- eta reduce
((#) x) ==> (x #) -- rotate operators
(flip op x) ==> (`op` x) -- rotate operators
\x y -> x + y ==> (+) -- insert operator
\x y -> op y x ==> flip op
\x -> x + y ==> (+ y) -- insert section,
\x -> op x y ==> (`op` y) -- insert section
\x -> y + x ==> (y +) -- insert section
\x -> \y -> ... ==> \x y -- lambda compression
\x -> (x +) ==> (+) -- operator reduction
foo xs = concat (map op xs) => concat . map op = > concatMapse
-
Research
-
Implementation
-
Weekly Reports
-
Meeting Feedback