Thanks for pointing this out. You're the second person who has found
that GHC is a bit too liberal in accepting non-H98 programs. The reason
for this was that checking of types themselves was a bit contorted.
I've
rejigged it now, and (once I've committed it) you should find that GHC
only
accepts H98 types.
Simon
| -----Original Message-----
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED]]
| Sent: 24 July 2001 12:38
| To: [EMAIL PROTECTED]
| Subject: GHC derives and accepts illegal Haskell98 contexts
|
|
|
| I have experimented with the definition of class assertions
| in section 4.1.3 in the Haskell 98 report, and found that GHC
| 4.08 and GHC 5.00.1 (invoked via ``ghc -c Test.hs'') both
| derive and accept type arguments (in class assertions) that
| do not have a variable as head.
|
| I cannot really imagine where this might hurt, though.
|
|
| By the way, I find that the .hi format of 5.00 is, from a
| human-readability point of view, in my opinion not optimal in
| that there is no separator after the __forall-bound variables:
|
| r2 :: __forall b (E (PrelBase.String, b)) => b -> PrelBase.Bool;
| ^
|
| There is no comparison with NHC since NHC still has the
| ``simple context restriction''.
|
|
| Best regards,
|
| Wolfram
|
| ==============================================================
| ===========
|
| module Test where
|
| class T a where
| t :: a b c -> Bool
|
| class E a where
| e :: a -> a -> Bool
|
| instance T (,) where
| t (a,b) = True
|
| q1 :: (T a,Eq (a String b)) => a String b -> Bool
| q1 x = if x == x then t x else True
|
| --r1 :: Eq (String, b) => b -> Bool -- derived and accepted by GHC
| --r1 :: Eq a => a -> Bool -- derived by Hugs98,
| -- accepted by both
| Hugs98 and GHC r1 x = q1 ("asd",x)
|
|
| q2 :: (T a,E (a String b)) => a String b -> Bool
| q2 x = if e x x then t x else True
|
| --r2 :: E (String, b) => b -> Bool -- derived and accepted by GHC
| r2 x = q2 ("asd",x) -- not accepted by hugs +98
|
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
|
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs