Incompatibility between Yi and GHC 6.8 (rc)

Jean-Philippe Bernardy bernardy at chalmers.se
Thu Oct 25 16:50:44 EDT 2007


Hello,

I spent some time to make Yi work with 6.8, and failed up to now.
Before I go into details, let's see what I'm trying to do with Yi.

The idea is to have a fully dynamic application where the user is
allowed to run arbitrary haskell code on the command line. This can be
used to quickly test new code, etc. In particular, one needs to be
able to "reload" the configuration in that manner.

This is achieved basically by having everything running inside a
specially made "GHC Session". The dynamic code is able to "reload
itself" because it is passed a pointer to the GHC session.

The GHC experts will see here that this cannot work :) Indeed, GHC has
a number of "global variables", which, if accessed through code loaded
in a GHC session, will be instanciated again. This means that
accessing a "level 1" session with "level 2" code is normally not
possible.

However, I found a workaround: encapsulate all calls to the GHC API in
a data structure in "level 1" code, which is then passed to "level 2".
(A haskell version of C-style callbacks). While this worked
beautifully with GHC 6.6, it fails with 6.8rc. with

  exception :: GhcException
  yi: panic! (the 'impossible' happened)
    (GHC version 6.8.0.20071019 for i386-unknown-linux):
          a static opt was looked at too early!

This happens at a seemingly unrelated point in the code. (inside the
bytecode interpreter?)

I can't really report a bug here, because what I'm trying to do is
probably fairly unsupported by GHC. However, I'd appreciate some sort
of advice. Is my workaround the correct approach? How would GHC people
implement a dynamic application? Should I drop the idea completely?
...

Thanks in advance for your help :)
-- JP

Attached: a darcs patch to the Yi repo to (try to) support 6.8.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6.8.patch
Type: text/x-patch
Size: 23558 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20071025/db60786e/6.8-0001.bin


More information about the Glasgow-haskell-users mailing list