Setting up Haskell in VS Code on macOS
Matthew Doig

Thanks for the article. A very helpful introduction.

This is a quick note for anyone else who is getting the following error:

Failed to load interface for 'Phoityne.Example.Math'

It appeared for me when I ran the command, $ stack test. The solution to this issue only became clear after I cloned the article’s supporting repository.

  1. For Haskell to pick up Math.hs as a file to be compiled add the following line to Main.hs,import Phoityne.Example.Math.
  2. Also, your project’s equivalent MyProject.cabal file will need to have its library-block amend. Somewhere around line 18 it should read,exposed-modules: Lib, Phoityne.Example.Math.

I suspect that, for point #2, changes to the .cabal file is something the stack tooling could do automatically. Presumably through a helpful command or somesuch.

Like what you read? Give Rajiv Bose a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.