On Tue, Oct 18, 2011 at 4:01 PM, Daniel Fischer <daniel.is.fischer@googlemail.com> wrote:
On Wednesday 19 October 2011, 00:27:19, Mike Meyer wrote:
> On Tue, Oct 18, 2011 at 2:47 PM, Daniel Fischer <
> I was actually contemplating adding a quality field to the record.
If you don't export the constructors and take care to create only hands
with the correct quality, that is possible. I'm not sure if it gains
anything, though.
>
> > instance Ord Hand where
> >
> > compare h1 h2 =
> >
> > case compare (quality h1) (quality h2) of
> >
> > EQ -> case h1 of
> >
> > StraightFlush c1 -> compare c1 (cards h2)
> > FourOfAKind r1 c1 ->
> >
> > case compare r1 (rank h2) of
> >
> > EQ -> compare c1 (cards h2)
> > other -> other
> >
> > ...
> >
> > other -> other
>
> What I'd really like to do is collapse the three types of comparison
> (i.e. - hand, rank hand, rank minorrank hand) into one comparison each.
I don't see what you mean, could you elaborate?