GHC 6.4 release candidates available

Simon Marlow simonmar at microsoft.com
Fri Mar 4 04:49:50 EST 2005


I think GHC's behaviour is right here.  To use the flag settings from
the source module on the command-line would be wrong: for example, when
the module is compiled, its implementation (and therefore flag settings)
must be hidden.

Also, as Simon pointed out, there might be multiple modules in scope at
the prompt, so how do you resolve the flag settings if they're
contradictory?

In general, flag settings affect the current source file only.  The flag
settings at the GHCi prompt are those given on the command line and from
:set - it's simple, no worrying about "where did that option come from?
I don't want overlapping instances!".

Cheers,
	Simon

On 02 March 2005 18:33, Keean Schupke wrote:

> Erm, what is the module context of GHCi? I thought ghci
> used the context of the loaded module:
> 
> ghci Test.hs
> 
> *Test>
> 
> I though the 'Test' in the prompt indicated you were in the context of
> the "Test" module. In which case the pragma at the top of the test
> module should be in force?
> 
>     Keean.
> 
> Simon Peyton-Jones wrote:
> 
>> Ah, yes.  In 6.2, overlap errors were checked and reported "eagerly"
>> 	at the instance declaration.  So instance C Int a
>> 	instance C b Bool
>> was rejected.  Now it isn't.  Instead the program is only rejected
>> if a constraint arises that matches two instance decls, and neither
>> is more specific.  For example (C Int Bool)
>> 
>> But many constraints are fine e.g. C Int Char
>> 
>> However this does have the consequence that the overlapping-instance
>> flag must be on in the module that calls the function rather than the
>> one that defines the instances.   It'd be better if the info
>> travelled with the instance decl, but it doesn't (yet).  A good
>> feature request. 
>> 
>> Simon
>> 
>>> -----Original Message-----
>>> From: glasgow-haskell-users-bounces at haskell.org
>>> [mailto:glasgow-haskell-users- bounces at haskell.org] On Behalf Of
>>> Keean Schupke 
>>> Sent: 02 March 2005 17:20
>>> To: Simon Peyton-Jones
>>> Cc: glasgow-haskell-users at haskell.org
>>> Subject: Re: GHC 6.4 release candidates available
>>> 
>>> In the past having:
>>> 
>>> {-# OPTIONS -fallow-overlapping-instances #-}
>>> 
>>> in a module was enough to get ghci to allow the overlaps.
>>> 
>>> so we do:
>>> 
>>> ghci Test.hs
>>> 
>>> now it does not work (but it did in 6.3), but:
>>> 
>>> ghci -fallow-overlapping-instances Test.hs
>>> 
>>> does... Even it Test.hs is the top level module.
>>> 
>>>     Keean.
>>> 
>>> Simon Peyton-Jones wrote:
>>> 
>>>> Ralf
>>>> 
>>>> You have a pragma "-fallow-overlapping-instances" in Test.hs, and
>>>> indeed it is honoured when compiling Test.hs.  But it's not taken
>>>> into account when compiling top-level expressions, or, indeed, if
>>>> you were to import Test into another module. 
>>>> 
>>>> If you say ":set -falllow-overlapping-instances" it'll work fine.
>>>> 
>>>> Now, maybe you'd like the flag to attach permanently to the
>>>> *instance*, so that if an instance decl is compiled with
>>>> -fallow-overlapping-instances, then no complaint will ever be
>>>> issued for its overlaps, even if it is imported into a module that
>>>> doesn't have -fallow-overlapping-instances.  That would make
>>>> sense, I think, but it's not implemented and never has been.
>>>> 
>>>> Simon
>>>> 
>>>>> -----Original Message-----
>>>>> From: glasgow-haskell-users-bounces at haskell.org
>>>>> [mailto:glasgow-haskell-users- bounces at haskell.org] On Behalf Of
>>>>> Ralf Lammel 
>>>>> Sent: 02 March 2005 08:45
>>>>> To: glasgow-haskell-users at haskell.org
>>>>> Subject: RE: GHC 6.4 release candidates available
>>>>> 
>>>>> I think this is an old bug,
>>>>> or at least I have seen it months back.
>>>>> 
>>>>> The "overlapping instances" directive does not make it to the
>>>>> top-level. See attached sample with the offending session.
>>>>> 
>>>>> Thanks for fixing.
>>>>> Ralf
>>>> 
>>>> _______________________________________________
>>>> Glasgow-haskell-users mailing list
>>>> Glasgow-haskell-users at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> Glasgow-haskell-users mailing list
>>> Glasgow-haskell-users at haskell.org
>>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>> 
>> 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list