| Here are some questions for the Haskell-98 enthusiasts.
Are implementors allowed to answer too? :-) It was a nice little puzzle!
| 1. Why is the following declaration group illegal?
|
| f :: String
| f = g 1 ++ g True
|
| g :: Show a => a -> String
| g x = fst (show x, show f)
Well according to my copy of the Haskell report, Section 4.5.2 on p56:
"If the programmer supplies explicit type signatures for more than one
variable in a declaration group, the contexts of these signatures must
be identical up to renaming of the type variables."
| 2. Is there a way to modify the signatures to make it legal?
Not that I can see!
Personally, I think you've found a bug in the Haskell report! But, as
it stands, others can reasonably say this is a bug in Hugs 98 ... I guess
we should modify the typechecker to reject this kind of program, at least
when Hugs is running in Haskell 98 mode. But it seems a shame to do all
that work for a check that people might prefer to do without :-(
All the best,
Mark