Hi Claus,

On Sat, Nov 03, 2007 at 03:11:58PM -0000, Claus Reinke wrote:
> 
> 1 the () defaulting in ghci looks highly dubious to me;
>    having an 'instance Num ()', as given in the doc example,
>    means that all arithmetic will fail, suggesting that this hack 
>    is far too intrusive:
> 
>        *Main> 1+2
>        *** Exception: def.hs:1:0: No instance nor default 
>                method for class operation GHC.Num.+

This doesn't seem to be a big problem to me. If for some reason you do
need a Num () instance (which I imagine is pretty rare) and you don't
want numbers to be defaulted to () in ghci you can always set
-XNoExtendedDefaultRules in ~/.ghci. Hmm, actually, that appears not to
work; not sure what's going on there.

(and the arithmetic only failed because you didn't give a complete
instance definition, of course. If you gave a complete definition then
you would have got the answer ())

> 2 while looking up 8.3.7, i saw this note in 8.3.6, on
>    postfix operators:
> 
>    "(No Haskell 98 programs change their behaviour, of course.)" 
> 
>    like so many "of course" notes, this is wrong, of course;-)
>    haskell98 has seq, and that makes eta-expansion observable.
> 
>    $ /cygdrive/c/ghc/ghc-6.4.1/bin/ghc -e 
>        'let (!) a = undefined in (undefined !) `seq` True'
>    True
> 
>    $ /cygdrive/c/ghc/ghc-6.6.1/bin/ghc -e 
>        'let (!) a = undefined in (undefined !) `seq` True'
>    *** Exception: Prelude.undefined

Good point. We probably ought to make it an extension and give it a -X
flag anyway; I don't think (without having looked at the code) it should
be hard.

Bug filed here: http://hackage.haskell.org/trac/ghc/ticket/1824


Thanks
Ian

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to