# How to practically enable \`-Wmissing-import-lists\`?

**URL:** <https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810>\
**Category:** Learn\
**Created:** [March 16, 2026, 3:09am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810 "2026-03-16T03:09:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![clinton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/clinton/32/4111_2.png) [@clinton](https://discourse.haskell.org/u/clinton)\
**Post date:** [March 16, 2026, 3:09am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/1 "2026-03-16T03:09:22Z")

</div>

**Edit** :

On further thought I think I might be able to achieve the below using [`hlint`](https://github.com/ndmitchell/hlint/blob/master/README.md#restricting-items) `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:

**Original post** :

So 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\].

Here’s the issue. I have in the codebase a number of imports like the following:

```haskell
import Prelude hiding (...)

```

`-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.

This forces me to do explicit Prelude import lists anywhere where there’s a Prelude hiding clause.

Whilst 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.

What 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.

I 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:

1. Not being able to hide anything from the Prelude OR
2. Having to explicitly list all Prelude imports, including things like `Bool` and `.`.

`-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).

I’ve even considered creating a CCP macro that spits out all the default imports I want from the Prelude in the form:

```haskell
import Prelude (Bool(True, False), (.), ($), ...)

```

won’t work because then I’ll get `-Wunused-import` warnings everywhere.

Suppressing the warning by line would help, but apparently this isn’t possible, assuming this [21 year old ticket](https://gitlab.haskell.org/ghc/ghc/-/issues/602) is still actually open.

Anyone 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.

* * *

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.

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [March 16, 2026, 8:16am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/2 "2026-03-16T08:16:50Z")

</div>

You could use an implicit custom prelude:

> **[6.2.10. Rebindable syntax and the implicit Prelude import — Glasgow Haskell...](https://downloads.haskell.org/~ghc/latest/docs/users_guide/exts/rebindable_syntax.html#custom-prelude-modules-named-prelude)**
>
> RebindableSyntax implies NoImplicitPrelude.

---

<div class="post-metadata">

**Author:** ![L0neGamer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/l0negamer/32/4536_2.png) [@L0neGamer](https://discourse.haskell.org/u/L0neGamer)\
**Post date:** [March 16, 2026, 10:44am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/3 "2026-03-16T10:44:43Z")

</div>

You could also use cabal’s mixins to replace prelude in another manner: [7. Package Description — Cabal 3.4.0.0 User's Guide](https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-mixins)

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [March 16, 2026, 10:53am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/4 "2026-03-16T10:53:02Z")

</div>

I considered this too, but don’t you then have to create two packages? I guess you could make a private sublibrary, but it seems like more work. Perhaps you can use mix-ins to rename the normal prelude to avoid having to use package imports in your custom prelude module.

---

<div class="post-metadata">

**Author:** ![L0neGamer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/l0negamer/32/4536_2.png) [@L0neGamer](https://discourse.haskell.org/u/L0neGamer)\
**Post date:** [March 16, 2026, 10:55am UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/5 "2026-03-16T10:55:11Z")

</div>

I’m not sure; unfortunately I don’t get to play with mixins like this too often, I just wanted to make sure that rewriting module names from packages like this wasn’t left to the wayside.

Can you use internal cabal library packages?

---

<div class="post-metadata">

**Author:** ![george.fst](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/george.fst/32/4933_2.png) [@george.fst](https://discourse.haskell.org/u/george.fst)\
**Post date:** [March 16, 2026, 5:36pm UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/6 "2026-03-16T17:36:41Z")

</div>

I tried this recently and it [doesn’t work](https://github.com/haskell/cabal/issues/11317) with “multiple home units” which is crucial for HLS to work smoothly in large projects, among other things.

---

<div class="post-metadata">

**Author:** ![rickowens](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/rickowens/32/4570_2.png) [@rickowens](https://discourse.haskell.org/u/rickowens)\
**Post date:** [March 16, 2026, 9:48pm UTC](https://discourse.haskell.org/t/how-to-practically-enable-wmissing-import-lists/13810/7 "2026-03-16T21:48:09Z")

</div>

This does not quite address your concerns exactly, but it is related. I maintain a compiler plugin called [om-plugin-imports](https://hackage.haskell.org/package/om-plugin-imports), which dumps a canonical list of imports that you can copy-paste into your module that satisfies `-Wmissing-import-lists`. (see [the readme](https://github.com/owensmurray/om-plugin-imports/tree/master/#om-plugin-imports))

It could be easily modified to create a plugin-based solution for exactly what you want. i.e. you wouldn’t actually use `-Wmissing-importlists` in your codebase. You would instead use a modified version of this plugin, which gave you the exact behavior you were looking for (a compile error when there are any missing imports except Prelude).

-Rick
