Compiler problem: Missing Module

Hi! I’m trying to learn my way into a Haskell compiler, before I get into coding too much and get continuously interrupted by my lack of compiler knowledge.

I asked an AI to generate some basic code, knowing that usually LLMs do not try and compile their code, so that’s a great way to bump in all sorts of trouble. Gemini didn’t disappoint, and it also was quite helpful with the basic fixes and pointers. However, I got to a point in which both myself and Gemini cannot understand what’s going on.

It seems to mean that I’m using some library version that misses a method. Or is a conflicting declaration? Can anyone give me a hint?
Thanks!

2025-01-08 18:05:10.419229: [warn] llvm-hs-pure > Could not find module ‘Control.Monad.List’.
2025-01-08 18:05:10.419315: [warn] llvm-hs-pure > Perhaps you meant
2025-01-08 18:05:10.419403: [warn] llvm-hs-pure > Control.Monad.Fix (from base-4.19.2.0)
2025-01-08 18:05:10.419506: [warn] llvm-hs-pure > Control.Monad.Zip (from base-4.19.2.0)
2025-01-08 18:05:10.419590: [warn] llvm-hs-pure > Control.Monad.Base (needs flag -package-id transformers-base-0.4.6)
2025-01-08 18:05:10.419674: [warn] llvm-hs-pure > Use -v to see a list of the files searched for.
2025-01-08 18:05:10.419752: [warn] llvm-hs-pure > |
2025-01-08 18:05:10.419833: [warn] llvm-hs-pure > 27 | import Control.Monad.List
2025-01-08 18:05:10.421270: [warn] llvm-hs-pure > | ^^^^^^^^^^^^^^^^^^^^^^^^^

Do you have cabal or stack file(s)? Just add missing dependencies like mtl to it.

1 Like

Situation as follows:
llvm-hs repo (v8) cloned locally to bypass a conflict with zip, namely:
import qualified Data.Functor as Functor

llvm-hs-pure.cabal has:
build-depends:
base >= 4.9 && < 5,
attoparsec >= 0.13,
bytestring >= 0.10 && < 0.11,
fail,
transformers >= 0.3 && < 0.6,
mtl >= 2.1.1,
template-haskell >= 2.5.0.0,
containers >= 0.4.2.1,
unordered-containers >= 0.2

So I assumed mtl would be there. I tried to add it to the project level cabal file, too, still no joy.

Please share a link to the repository, if possible.

Control.Monad.List has been removed from mtl since version 2.3 because it was incorrect. You could add a < 2.3 upper bound to mtl, but really the best solution is to stop using that module.

4 Likes

Code here: GitHub - bertodse/odalisk: just testing Haskell code there’s nothing private with it, I just asked Gemini to write an application that does an FFT on a wav file, in order to get dept complexity.

Ah! So that’s a great thing to know. Testing that

Adding
mtl >= 2.1.1 && < 2.3,

to my llvm-hs-pure.cabal file doesn’t seem to have an impact, the error is unchanged.

On a parallel line… how would I know where a module can be found, if I have no idea that it supposed to come from mtl? I tried checking with hackage, but I haven’t found any obvious way.

Code here: GitHub - bertodse/odalisk: just testing Haskell code there’s nothing private with it, I just asked Gemini to write an application that does an FFT on a wav file, in order to get dept complexity.

The problem lies in one of your extra dependencies - llvm-hs-pure . As stated on hackage page it requires mtl (>=2.1 && <2.3), on the other hand in your stack.yaml file you declared the most recent LTS version (23.3) which comes with mtl-2.3.1. Also on llvm-hs-pure hackage page there is a note about library being tested with ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5.
How to proceed with that, harder way would be to refactor llvm-hs-pure to be compatible with newer libraries, easier just downgrade LTS version in stack.yaml file (14.27 or maybe something newer).

1 Like

The llvm-hs-pure that you cloned includes a stack.yaml file which states resolver: lts-10.8, so that should work.