Redefining built in syntax
Tim Chevalier
catamorphism at gmail.com
Thu Jan 3 14:05:34 EST 2008
Hi, Neil--
On 1/3/08, Neil Mitchell <ndmitchell at gmail.com> wrote:
> Hi Victor,
>
> > -package-name base
> >
> > should do the thing
>
> Thanks very much, that is the correct flag to allow built in syntax.
> However, turning that flag on also does other stuff, which breaks new
> things. Taking the module Prelude.hs, from a darcs checkout of the
> libraries:
>
> C:\Documents\Uni\packages\base>ghci Prelude.hs -i -cpp -fglasgow-exts
> GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help
> Loading package base ... linking ... done.
> Ok, modules loaded: Prelude.
>
> i.e. you can load the Prelude. However, specifying -package-name base:
>
> C:\Documents\Uni\packages\base>ghci Prelude.hs -i -cpp -fglasgow-exts
> -package-name base
> GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help
>
> <interactive>:1:22:
> Failed to load interface for `System.IO':
> it is not a module in the current program, or in any known package.
>
> <interactive>:1:22: Not in scope: `System.IO.stderr'
>
> <interactive>:1:22: Not in scope: `System.IO.stdin'
> : panic! (the 'impossible' happened)
> (GHC version 6.8.1 for i386-unknown-mingw32):
> interactiveUI:setBuffering
>
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
Yeah, I've seen this before. One thing is that I generally avoid
running code that uses the GHC API in GHCi, because I saw some
reference somewhere to the fact that data structures can get mixed up
that way, and it just seems to lead to madness :-) I've definitely
seen the setBuffering panic message before, though haven't filed a bug
report since I can't reproduce it reliably.
In GHC, though, I can compile base package modules to Core just fine,
if I provide the right import flags (-i and -I) so it can find all the
dependencies. (If you want to see the complete list of flags I'm
using, let me know :-)
> This is the same behaviour as loading Prelude without specifying -i.
> Moving -i to other places still gives the same behaviour. Does
> package-name base also imply other flags (perhaps -i. ?) which are
> negatively effecting my particular use.
>
I don't know, but in GHC (as opposed to GHCi), it all works. I can
post some sample code if that would help; let me know.
Cheers,
Tim
--
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
"More than at any other time in history, mankind faces a crossroads.
One path leads to despair and utter hopelessness. The other, to total
extinction. Let us pray we have the wisdom to choose
correctly."--Woody Allen
More information about the Glasgow-haskell-users
mailing list