{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigve3ivbebjdtkmnuhzzpkkx6dbnigcgmh2e3p3hjp4ikb7atg4sy",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mh5kp74r76p2"
},
"path": "/t/how-to-practically-enable-wmissing-import-lists/13810#post_1",
"publishedAt": "2026-03-16T03:09:22.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"`hlint`",
"[1]",
"21 year old ticket",
"↩︎"
],
"textContent": "**Edit** :\n\nOn further thought I think I might be able to achieve the below using `hlint` `importStyle` directives, but that’s WIP. Will post results here. But I will leave the original post if people have a simpler way of working this out:\n\n**Original post** :\n\nSo I’ve started working on a medium size Haskell codebase (high five figures in LOC) built using GHC and I’m working on making the warnings stricter to clean up the codebase and keep it clean. What I would like to do is enable `-Wmissing-import-lists` and naturally `-Werror`. I like to be able to at a glance be able to see where a function is coming from, and `-Wmissing-import-lists` achieves this, by requiring imports to be either qualified or explicit [1].\n\nHere’s the issue. I have in the codebase a number of imports like the following:\n\n\n import Prelude hiding (...)\n\n\n`-Wmissing-import-lists` complains about this. Which I think is silly, because it doesn’t complain about an implicit Prelude import, despite the fact it has no import list, and `import Prelude hiding (...)` actually imports LESS than an implicit Prelude import.\n\nThis forces me to do explicit Prelude import lists anywhere where there’s a Prelude hiding clause.\n\nWhilst I do think there’s too much in the Prelude, I think `-Wmissing-import-lists` forcing one to import `Bool(True, False)` just so one can hide something from the Prelude is a bit silly.\n\nWhat I would probably ideally like to do is leave on `-Wmissing-import-lists`, also turn on `NoImplicitPrelude`, and write my own Prelude module (say `MiniPrelude`) that only exports a subset of Prelude, but allow that module, and only that module, to be imported without an import list.\n\nI don’t really know what to do here. It seems like `-Wmissing-import-lists`, whilst a useful warning, is completely impractical unless one is okay with:\n\n 1. Not being able to hide anything from the Prelude OR\n 2. Having to explicitly list all Prelude imports, including things like `Bool` and `.`.\n\n\n\n`-Wmissing-import-lists` even makes `NoImplicitPrelude` impractical, because wherever one uses their alternative Prelude one needs to import everything explicitly (when presumably one’s explicit prelude is carefully curated anyway).\n\nI’ve even considered creating a CCP macro that spits out all the default imports I want from the Prelude in the form:\n\n\n import Prelude (Bool(True, False), (.), ($), ...)\n\n\nwon’t work because then I’ll get `-Wunused-import` warnings everywhere.\n\nSuppressing the warning by line would help, but apparently this isn’t possible, assuming this 21 year old ticket is still actually open.\n\nAnyone have any idea how I can move forward here. I would really like to enable `-Wmissing-import-lists`, as it really helps me navigate and keep clean a currently messy codebase where the interdependencies are far from clear, but the resulting requiring of explicit Prelude exports and not allowing for a practical smaller custom Prelude is proving a very annoying showstopper.\n\n* * *\n\n 1. I know HLS when it’s working well can give you this information as well but it’s flaky and sometimes slow to load and adjust to refactors on large projects so I don’t want to rely on it. ↩︎\n\n\n",
"title": "How to practically enable `-Wmissing-import-lists`?"
}