ndmitchell/hlint

Incorrect refactor of "Use forM_"

Opened this issue · 1 comments

Version: reproducible from master head (ac5a004)
Minimal example:

import Data.Traversable -- /tmp/min.hs

main = forM [] print >> pure ()
$ stack exec -- hlint /tmp/min.hs 
min.hs:3:8: Warning: Use forM_
Found:
  forM [] print
Perhaps:
  forM_ [] print

1 hint

This refactor results in a compilation error because forM_ is not in scope - I would expect output message to inform me that I haven't brought any forM_ into scope yet.

It used to be that forM and forM_ were in the same module, so we didn't bother. Now we should default to showing Control.Monad.forM_ and dequalify that with the standard things. Fairly low priority though - it would take a fair bit of stuff to get it working, and this area is being actively reworked as we speak.