Skip to content

Instantly share code, notes, and snippets.

@Profpatsch
Last active July 19, 2022 14:07
Embed
What would you like to do?
hlint, the helpful parts
# HLint configuration file
# https://github.com/ndmitchell/hlint
# Run `hlint --default` to see the example configuration file.
##########################
# Ignore some builtin hints
# often functions are more readable with explicit arguments
- ignore: { name: Eta reduce }
# these redundancy warnings are just completely irrelevant
- ignore: { name: Redundant bracket }
- ignore: { name: Move brackets to avoid $ }
- ignore: { name: Redundant $ }
- ignore: { name: Redundant do }
- ignore: { name: Redundant multi-way if }
# allow case-matching on bool, because why not
- ignore: { name: Use if }
# hlint cannot distinguish actual newtypes from data types
# that accidentally have only one field
# (but might have more in the future).
# Since it’s a mostly irrelevant runtime optimization, we don’t care.
- ignore: { name: Use newtype instead of data }
# these lead to harder-to-read/more implicit code
- ignore: { name: Use fmap }
- ignore: { name: Use <$> }
- ignore: { name: Use tuple-section }
# fst and snd are usually a code smell and should be explicit matches, _naming the ignored side.
- ignore: { name: Use fst }
- ignore: { name: Use snd }
- ignore: { name: Use fromMaybe }
- ignore: { name: Use const }
- ignore: { name: Replace case with maybe }
- ignore: { name: Replace case with fromMaybe }
- ignore: { name: Avoid lambda }
- ignore: { name: Avoid lambda using `infix` }
- ignore: { name: Use curry }
- ignore: { name: Use uncurry }
- ignore: { name: Use first }
- ignore: { name: Redundant first }
- ignore: { name: Use second }
- ignore: { name: Use bimap }
# just use `not x`
- ignore: { name: Use unless }
# list comprehensions are a seldomly used part of the Haskell language
# and they introduce syntactic overhead that is usually not worth the conciseness
- ignore: { name: Use list comprehension }
# Seems to be buggy in cases
- ignore: { name: Use section }
# multiple maps in a row are usually used for clarity,
# and the compiler will optimize them away, thank you very much.
- ignore: { name: Use map once }
- ignore: { name: Fuse foldr/map }
- ignore: { name: Fuse traverse/map }
# this is silly, why would I use a special function if I can just (heh) `== Nothing`
- ignore: { name: Use isNothing }
# The duplication heuristic is not very smart
# and more annoying than helpful.
# see https://github.com/ndmitchell/hlint/issues/1009
- ignore: { name: Reduce duplication }
# Stops the pattern match trick
- ignore: { name: Use record patterns }
- ignore: { name: Use null }
- ignore: { name: Use uncurry }
# we don’t want void, see below
- ignore: { name: Use void }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment