• Iustin Pop's avatar
    Cleanup hlint errors · 3603605a
    Iustin Pop authored
    First, we update the recommended hlint version to what I used to get a
    clean output (1.8.15). Most of the changes are:
    - remove unneeded parentheses
    - some simplifications (intercalate " " → unwords, maybe … id →
      fromMaybe, etc.)
    - removal of some duplicate code (in previous patches)
    There are still some warnings which I didn't clean out but plain
    - 'Eta reduce' in some specific files, because the type inference
      specialises the function on the first call, and annotating the type
      properly would be too verbose
    - use of 'first', 'comparing', and 'on', since these don't seem to be
      widely or consistently used (outside ganeti/htools, I mean)
    - use of Control.Exception.catch, as we only care about I/O errors; at
      one point yes, we will need to transition to this new API
    - 'Reduce duplication', since hlint warns even for 3 duplicate lines,
      and abstracting that away seems overkill to me
    After this patch, make hlint is clean and doesn't exit with an error
    anymore; we could enable it automatically on 'make lint' if hlint is
    detected (future patch).
    Note that we explicitly skip the THH.hs file from checking because it
    seems that hlint doesn't parse correctly for now the splice notation.
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
CLI.hs 20.1 KB