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

前端 未结 1 1601
太阳男子
太阳男子 2021-02-19 07:58

Hello Haskell community,

I\'m new to Haskell and ran into a problem when I tried to structure my first bigger project.

Here\'s the minimal example of the problem

相关标签:
1条回答
  • 2021-02-19 08:11

    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.

    0 讨论(0)
提交回复
热议问题