|
Re: Constr and Eq: msg#00166lang.haskell.glasgow.bugs
I see. Maybe there should be a separate function efficientConstrEq :: Constr -> Constr -> Bool so that people don't get confused with the standard Eq definition? How often is the efficient version needed? In any case, it seems like we should document the fact that the Constr Eq instance doesn't work in the usual way. Frederik On Thu, Dec 29, 2005 at 11:23:15AM -0800, Ralf Lammel wrote: > As of today, this is done so to be efficient. > You can easily compare the data types of the constructors to further > constrain equivalence, when this is necessary, while the base check only > compares an Integer value for the constructors. > Ralf > > > > -----Original Message----- > > From: glasgow-haskell-bugs-bounces@xxxxxxxxxxx > [mailto:glasgow-haskell- > > bugs-bounces@xxxxxxxxxxx] On Behalf Of Frederik Eaton > > Sent: Thursday, December 29, 2005 10:57 AM > > To: glasgow-haskell-bugs@xxxxxxxxxxx > > Subject: Constr and Eq > > > > > toConstr True > > True > > > toConstr [()] > > (:) > > > toConstr True == toConstr [()] > > True > > > show (toConstr True) == show (toConstr [()]) > > False > > > > I don't understand the utility of Constr's Eq definition. It isn't > > really documented though. Why return True when the constructors being > > compared are different? Am I supposed to use (show.toConstr) to > > compare constructors? > > > > Here is the documentation I could find: > > > > data Constr > > Representation of constructors > > Instances > > Show Constr > > Eq Constr > > > > This is ghc 6.4.1. > > > > Thanks, > > > > Frederik > > _______________________________________________ > > 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: Constr and Eq, Ralf Lammel |
|---|---|
| Next by Date: | missing Data instances, Frederik Eaton |
| Previous by Thread: | RE: Constr and Eq, Ralf Lammel |
| Next by Thread: | missing Data instances, Frederik Eaton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |