Hi Fergus.
> > > data OrdFuncExist = OE (Ord a => Char -> a)
> >
> That's not the syntax for a existential type,
> that's the syntax for a universally quantified type
> with rank-2 polymorphism. With that syntax, the
> argument of `OE' must be a polymorphic function
> with type `forall a . Ord a => Char -> a'.
That would explain a lot. There seems to be a discrepancy between ghc
and the ghc user-guide, in that event.
> Is this supposed to be a heterogenous list,
> or a homogeneous list?
Sorry, I should have been a tad less terse: it's intended to be
a homogeneous list, else the maximum wouldn't be well-typed.
> Hmm, I'm not sure exactly what you're trying to achieve here...
> but perhaps you just need to add
>
> instance Ord AnyOrd where
> compare (MkAnyOrd x) (MkAnyOrd y) = compare x y
>
> to make it work.
I haven't tried this, but this is unwrapping two (potentially)
_different_ types, and then trying to compare them, isn't it?
(Been there, done that, didn't like the type errors, in a previous
brush with existential types...)
Cheers,
Alex.