Haskell Cabal package - can't find Paths_ module

前端 未结 1 1451
借酒劲吻你
借酒劲吻你 2021-02-14 20:32

I\'m working on a Haskell project (Happstack server + Blaze HTML/front-end as main libraries) and I want to add a static data directory.

Looks like you can do so with C

1条回答
  •  天涯浪人
    2021-02-14 21:12

    Paths_* modules are only generated by Cabal during builds. If you're running the package using GHCi or cabal repl then they simply won't exist and your code will fail with "Cannot find module" errors.

    There's a sneaky development mode trick, though: just build your own Paths_* module and place it in your haskell-source-dir. During development, GHCi will load that module and you can adjust its exported symbols to make your development environment fly. During build, Cabal will overwrite your module with its own and take into account the final information needed to build the Paths_* module.

    So in this particular case, just make a file src/Paths_stackbuilders.hs and provide it a relative path to the datadir.

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