'Failed to load interface' error when loading compiled modules in ghci

拥有回忆 提交于 2019-12-04 01:35:18
asm

Edit: September 2016

Since I originally answered this question there is a growing practice of defining Foo.Internal modules that are still exposed. In the original answer below I suggested using the other-modules field. A practice that is now popular is to define Foo.Internal.* modules that are exposed but explicitly not part of the supported API. The rational for this pattern is explained in the answers to this question.


As noted in the comments your .cabal file is missing the other-modules line. I think cabal install then only installs FoodMod1 since that is all it's been told about.

This is a nice way to create internal modules with, for instance, types that are used throughout your cabal package which you don't want to expose in the package API. Since the other-modules modules cannot be imported from outside your package it allows you to create package private functionality.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!