Re: Hypergraph module (Re: instance Ord FiniteMap)

2002-05-30 Thread Johannes Waldmann
(Re: Eray's code using FiniteMaps/Sets) > Comments welcome, I'd suggest > show s = "mkSet " ++ show (setToList s) > show fm = "listToFM " ++ show (fmToList fm) That way you can easily paste the output of a program into your code back again, and you can easily tell the type of the `showed'

Hypergraph module (Re: instance Ord FiniteMap)

2002-05-30 Thread Eray Ozkural
On Wednesday 29 May 2002 02:58, Hal Daume III wrote: > Is there any particular reason FiniteMap (and hence Set) aren't instances > of Ord? I realize it's "weird" to define a map to be ordered, but even if > the Ord definition were in some sense "nonsensical", being able to have, > for instance, S

Re: instance Ord FiniteMap

2002-05-29 Thread Alastair Reid
Johannes Waldmann <[EMAIL PROTECTED]> writes: > I find that I use Set and FiniteMap rather for reasons of clarity in > coding. This is what `you guys in industry' call `academic > programming', right :-) If speed is really an important issue, then > one would have to resort to some kind of hash

Re: instance Ord FiniteMap

2002-05-29 Thread Johannes Waldmann
> > setToList will be very inefficient (or at least much more so than an > > instance which actually looks at the tree structure). this would be much more difficult to design, since one and the same set may be represented by quite different trees: they might have been created by inserting element

RE: instance Ord FiniteMap

2002-05-29 Thread Simon Marlow
I'll happily incorporate the code if someone sends me a patch... Cheers, Simon > -Original Message- > From: Hal Daume III [mailto:[EMAIL PROTECTED]] > Sent: 29 May 2002 15:03 > To: Johannes Waldmann > Cc: GHC Users Mailing List > Subject: Re: instance

Re: instance Ord FiniteMap

2002-05-29 Thread Hal Daume III
I agree; the problem is that I fear that making my own instance by using setToList will be very inefficient (or at least much more so than an instance which actually looks at the tree structure). -- Hal Daume III "Computer science is no more about computers| [EMAIL PROTECTED] than astrono

Re: instance Ord FiniteMap

2002-05-28 Thread Johannes Waldmann
> for instance, Sets of Sets of things would be really nice. Sure. One could simply use lexicographic ordering (i. e. s1 `compare` s2 = setToList s1 `compare` setToList s2) or length-lexicographic ordering (for efficiency) ... = (cardinality s1, setToList s1) `compare` (cardinality s2, setToLis

Re: instance Ord FiniteMap

2002-05-28 Thread Eray Ozkural
On Wednesday 29 May 2002 02:58, Hal Daume III wrote: > Is there any particular reason FiniteMap (and hence Set) aren't instances > of Ord? I realize it's "weird" to define a map to be ordered, but even if > the Ord definition were in some sense "nonsensical", being able to have, > for instance, S