mthadley/elm-review-unit/2.0.0

NOTE: the latest version is 2.0.2

NoUnmatchedUnit

rule : Rule

Reports when a Unit (()) is not matched in a pattern.

config =
    [ NoUnmatchedUnit.rule
    ]

Fail

foo : () -> Int
foo _ =
    3

Success

foo : () -> Int
foo () =
    3

When (not) to enable this rule

  • Nobody on your team thinks explicitly matching against the Unit makes the code more readable (as far as showing that there wasn't a "real" value being ignored).
  • When you feel that Unit is often used as a placeholder for a value that will soon be filled in later.

Try it out

You can try this rule out by running the following command:

elm-review --template mthadley/elm-review-unit/example --rules NoUnmatchedUnit