|
| <prev next> |
RE: Possible instances problem with ghc-6.2.1: msg#00059lang.haskell.glasgow.bugs
George This "bug" is the same as the one I described in the enclosed message, but it's a bit simpler this time. The basic setup is: newFormEntry :: HasButton value => Radio value -> Int instance Show value => HasButton value foogle :: (HasButton woggle) => Radio woggle -> Int foogle lab = let form0 = newFormEntry lab in undefined The call to newFormEntry requires the constraint (HasButton woggle). You point out that (HasButton woggle) is available in foogle's type. But it's *also* available via instance Show value => HasButton value So it depends on which of two (incompatible!) ways of deriving (HasButton woggle) wins. GHC makes no guarantees about this. In fact, a recent change (don't ask) makes GHC just a bit keener to do context simplification at monomorphic local definitions (like that for form0). So GHC tries to simplify the (HasButton woggle) constraint at the "form0 = ..." point, and succeeds by using the instance declaration. In short, you'd defined a non-confluent rewrite system, so you should not be surprised if it unpredictably paints you into a corner, and does so differently on different days of the week. Simon | -----Original Message----- | From: glasgow-haskell-bugs-bounces@xxxxxxxxxxx [mailto:glasgow-haskell-bugs- | bounces@xxxxxxxxxxx] On Behalf Of George Russell | Sent: 26 March 2004 10:21 | To: glasgow-haskell-bugs@xxxxxxxxxxx | Subject: Possible instances problem with ghc-6.2.1 | | With ghc-6.2.1 compiled from source | | tar -xzf instances2.tar.gz | cd instances2 | gmake | | produces the message: | | AttributesType.hs:15: | Could not deduce (Show value) | from the context (AttributeValue (Radio value), | HasConfigRadioButton value, | Bounded value, | Enum value, | FormLabel label) | arising from use of `newFormEntry' at AttributesType.hs:15 | | | | However: | (1) this does not seem to happen with ghc-6.2. | (2) why does newFormEntry need Show anyway? It would only be | relevant in deducing HasConfigRadioButton, but in fact | it has that in the context anyway. | | | Sorry I didn't report this earlier. --- Begin Message ---_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Bug in the proof of Data.FiniteMap and DData.Map, Daan Leijen |
|---|---|
| Previous by Thread: | Possible instances problem with ghc-6.2.1, George Russell |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |