ndmitchell / ndmitchell/hlint

Hlint gets confused by `import Prelude ()`

Open
#460 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope
Dominant language
Haskell
Stars
1.6k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

$ hlint --version
HLint v2.1.1, (C) Neil Mitchell 2006-2018

This seems to affect custom hints that don't use anything from Prelude (such as the wibble example in the defaults) as well.

Test1.hs

module Test where

import Prelude ()

f = concat $ map (+1) [1]
$ hlint Test.hs
No hints

But it's fine if NoImplicitPrelude is used instead

Test2.hs

{-# LANGUAGE NoImplicitPrelude #-}
module Test where

f = concat $ map (+1) [1]
$ hlint Test2.hs
Test2.hs:4:5: Warning: Use concatMap
Found:
  concat $ map (+ 1) [1]
Why not:
  concatMap (+ 1) [1]

1 hint

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided Test1.hs and Test2.hs examples, then trace how HLint handles import Prelude () versus NoImplicitPrelude. Done means the same applicable hints, including concatMap, are reported when Prelude is explicitly imported empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.