When trying to compile my ghcjs
/jsaddle
based Haskell website, I get
Main.hs:20:1: error:
Failed to load interface for ‘GHCJS.DOM.Element’
It is a member of the hidden package ‘jsaddle-dom-0.9.2.0’.
Perhaps you need to add ‘jsaddle-dom’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
even though jsaddle-dom
is already in the build-depends
of my cabal file.
So I can't do what the error message suggests.
What's going on?
You should put build-depends: ghcjs-dom
instead of build-depends: jsaddle-dom
in your cabal file.
This is because ghcjs-dom
is the multiplexer between the real ghcjs-dom-jsffi
and jsaddle-dom
.
Check out the ghcjs-dom cabal file to see that.
Why is ghc's error message so misleading? Thanks to jonored
from the #reflex-frp
freenode IRC channel for this explanation:
ghcjs-dom is just a reference to the module in jsaddle on that platform. so it's not where it actually canonically is, and ghc tells you about where it is. But you want ghcjs-dom, so that it tells you the ghcjs-based implementation on ghcjs.