export haskell module with different hierarchy

前端 未结 1 1995
南笙
南笙 2021-01-21 07:09

In Haskell, modules name and file name containing the module have to be the same. The problem is is not only the file name but the includes the all path, so you have (AFAIK) to

相关标签:
1条回答
  • 2021-01-21 07:56

    This isn't possible at present, short of using symlinks or similar to point Database.M to M which would have various problems with portability and version control.

    Simon Marlow proposed a new option for GHC to add support for aliases a few months ago: http://www.haskell.org/pipermail/glasgow-haskell-users/2014-April/024920.html

    His idea was that you could run ghc with a new variant of the -i option:

    ghc -iDatabase.M=M
    

    and then anything in the M folder would be treated as being part of Database.M as you want.

    You'd also be able to put the new option in the hs-source-dirs field in .cabal files.

    However there were various objections to the proposal so he's withdrawn it for now. The main problems were that it adds complexity and several other tools (e.g. cabal) would also have to be changed to support it.

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