Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
/ hlint-lib Public archive

Library containing some standard HLint helpers

License

Notifications You must be signed in to change notification settings

vmchale/hlint-lib

Repository files navigation

hlint-lib

Build Status

Configuration for hlint, as a Dhall library.

Use

As an example:

let hlint = ./constructors.dhall

let recursion = ./recursion.dhall

let fixity = ./fixity.dhall

let base = ./base.dhall

let bannedFunctions =
      [ hlint.functions { functions = [ hlint.globalBan "fromJust" ] } ]

in  fixity.defFixities # bannedFunctions # recursion # base

Save this as hlint.dhall, run dhall-to-yaml --file hlint.dhall and you should get

- fixity: "infixr 3 ***"
- fixity: "infixr 3 &&&"
- fixity: "infixr 2 +++"
- fixity: "infixr 2 |||"
- fixity: "infixr 1 <=<"
- fixity: "infixl 4 <$"
- fixity: "infixl 4 $>"
- fixity: "infixl 1 <&>"
- fixity: "infixl 4 *>"
- fixity: "infixl 4 <*"
- fixity: "infixl 3 <|>"
- fixity: "infixl 4 <**>"
- functions:
    - name: fromJust
      within: []
- error:
    lhs: "hylo embed"
    name: "Use ananorphism"
    rhs: ana
- error:
    lhs: "hylo f project"
    name: "Use catamorphism"
    rhs: "cata f"
- error:
    lhs: "hyloM (pure . embed)"
    name: "Use monadic anamorphism"
    rhs: anaM
- error:
    lhs: "hyloM f (pure . project)"
    name: "Use monadic catamorphism"
    rhs: "cataM f"
- error:
    lhs: "fmap (const x)"
    rhs: "(x <$)"
- error:
    lhs: "fmap (const ())"
    name: "Use void"
    rhs: void
- error:
    lhs: "fromMaybe []"
    name: Use concat
    rhs: concat

...containing prepackaged hints for working with recursion schemes as well as fixity declarations for various operators in base.

Contents

Lovingly provided by polyglot:

───────────────────────────────────────────────────────────────────────────────
 Language             Files       Lines         Code     Comments       Blanks
───────────────────────────────────────────────────────────────────────────────
 Dhall                    7         141          117            0           24
 Makefile                 1           9            6            0            3
 Markdown                 2          90           73            0           17
 YAML                     1          26           24            0            2
───────────────────────────────────────────────────────────────────────────────
 Total                   11         266          220            0           46
───────────────────────────────────────────────────────────────────────────────