RE: Haskell-98 Quiz
Mark P Jones writes: > | 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 :-( I think I prefer the Hugs 98 behaviour :-) /M
RE: Haskell-98 Quiz
| 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
Re: Haskell-98 Quiz
Magnus Carlsson wrote: > Here are some questions for the Haskell-98 enthusiasts. I'm not sure if I'm a Haskell-98 enthusiast, I still call myself a Haskell enthusiast. > 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) I don't see why it should be illegal, but then nor does Hugs 98. It is happy with this definition and gives "1True" for f. So if you found a subtle strange thing in Haskell 98, you also found a bug in Hugs. Christian Sievers