Re: Possible bug in ghc 4.08.1, I leave it to you

2001-02-01 Thread Sigbjorn Finne


Martin Norbäck [EMAIL PROTECTED]  writes:
>
> Hi!
>
> > a :: Show c => c -> Integer
> > a err = if b > 0 then error (show err) else 1
>
> > b :: Integer
> > b = a "dummy"
>
> This program (although it doesn't do much good), type checks perfectly
> in hugs. (I have a larger version which actually does some good as
> well).
>
> But in ghc 4.08.1 I get the following error.
>
>Mismatched contexts
> When matching the contexts of the signatures for `b' and `a'
> (the signature contexts in a mutually recursive group should all be
identical)

> But where is this requirement in the Haskell report? It might be that I
> don't understand what the report says, but this seems like a perfectly
> good use to me.

See 4.5.2 of the report and section 11.6.3 of Mark Jones' "Typing Haskell
in Haskell" (http://www.cse.ogi.edu/~mpj/thih/ ) paper for a discussion of
the issue. The conclusion there is that the H98 restriction on the shape of
signature contexts in mut-rec groups is overly restrictive. Last I heard
(about 12 months ago) was that Simon PJ _might_ consider treating this
as a bug in the H98 report & change it.

hth
--sigbjorn


___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



Possible bug in ghc 4.08.1, I leave it to you

2001-02-01 Thread Martin Norbäck

Hi!

> a :: Show c => c -> Integer
> a err = if b > 0 then error (show err) else 1

> b :: Integer
> b = a "dummy"

This program (although it doesn't do much good), type checks perfectly
in hugs. (I have a larger version which actually does some good as
well).

But in ghc 4.08.1 I get the following error.

Mismatched contexts
When matching the contexts of the signatures for `b' and `a'
(the signature contexts in a mutually recursive group should all be identical)

But where is this requirement in the Haskell report? It might be that I
don't understand what the report says, but this seems like a perfectly
good use to me.

If i remove the type declarations I get errors about c not being general
enough in my code, and in this small example it is mysteriously
instantiated to String!

If you could help me with this problem it would be much appreciated!

Martin

-- 
[ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN: 4439498 ]
Opinions expressed above are mine, and not those of my future employees.

SIGBORE: Signature boring error, core dumped

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs