NoImplicitPrelude is not well handled
I have a project which uses NoImplicitPrelude to replace the stock Haskell prelude. Thus, all the modules must import that custom prelude. However, there seems to not be a knob to turn (besides the hilarious idea of exporting a prelude from the Scalars module, which is a viable workaround) to actually ask graphql-codegen to import a module from the apiModule to get symbols like Show.
Hm would explicitly adding {-# LANGUAGE ImplicitPrelude #-} work, or do you want graphql-codegen to explicitly import a different prelude?
If the latter, a couple options come to mind:
- Use a cabal mixin to rename your custom prelude as
Prelude - Add a step that runs
sedon the generated file to use your module instead
If neither of those options work, then I'd be open to a PR that allows the user to configure the prelude to use
Hmmm. Good question. I did just wind up reexporting the prelude from the scalars module and fixed my problem by doing so; it looks like the main work codebase authors had the same idea.
Cabal mixin is possible but I don't know how those work. Perhaps adding ImplicitPrelude is okay; I doubt it will cause problems at the very least except to the most dedicated prelude replacement projects.
https://cabal.readthedocs.io/en/stable/cabal-package-description-file.html#pkg-field-mixins
You should be able to add
mixins:
base (Prelude as PreludeBase)
and then rename your CustomPrelude.hs as just Prelude.hs, then the implicit prelude in the rest of your project would import your prelude with the implicit import Prelude