[jhc] Parsec -- Module not found

John Meacham john at repetae.net
Tue Aug 10 18:03:43 EDT 2010

On Tue, Aug 10, 2010 at 08:35:34AM +0000, Korcan Hussein wrote:
> Yes I can confirm it's just a missing package, "jhc -p parsec ..."
> works fine for me. Regarding the documentation it was quite clear to
> me and it was relatively near the top of the page so it's not hard to
> miss, how about a feature similar to "ghc --make"? that would be quite
> useful because using more than 3/4 libraries can get unwieldy although
> I have no idea the complexity of implementing it.

Actually, jhc does do the equivalent of ghc's --make always, how it
differs is that jhc always behaves like ghc if it is given the
-hide-all-packages flag.

GHC packages are somewhat complicated, there are a few different things
that need to happen to get them to work, first you need to drop the
files into an appropriate directory, then you need to use ghc-pkg to
register your package, which writes to a config file telling ghc where
it can find the package, then you need to 'expose' the package, so that
ghc can see it. This works fine when your exposed packages just happen
to be exactly what you want. But as soon as you have multiple versions
of ghc installed or some libraries installed globally and some installed
per user or you have multiple packages that implement the same API that
you want to choose between things get tricky. Basically, when you need
to do "interesting" things with ghc, it gets fairly complicated. In
fact, to write a portable ghc build file you pretty much always have to
do -hide-all-packages then explicitly list the ones you want anyway. Not
that these things are impossible in ghc, they are just somewhat
complicated and require special knowledge of how ghc-pkg works.

For jhc I wanted a much simpler model, similar to the C model. Libraries
just need to be findable by jhc (meaning they are in a directory it
searches in or specified by -L on the command line) and exactly what you
specify by '-p' along with what the targets.ini specifies are what are
available for importing.

Being able to fully describe jhcs library model in a single sentence
seemed more useful to me than making a certain common case that is
somewhat brittle easier. After all, once you know the once sentence
description of how jhc works you can figure everything out. However, I
still get stuck in "ghc dependency hell" occasionally and find myself
having to re-install packages.

Also, note that you only need to specify the '-p' for packages that you
_directly_ use, for instance, even though 'containers' uses
'applicative' in its implemenation, you only need -pcontainers to use


John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/

More information about the jhc mailing list