On Wed, Jan 7, 2015 at 4:49 PM, Geoffrey Irving <[email protected]> wrote:

> On Wed, Jan 7, 2015 at 4:40 PM, Jonathan S. Shapiro <[email protected]>
> wrote:
>
> I think I may be getting confused somewhere.  If type classes are
> required to be statically resolvable constants, doesn't it become
> impossible to avoid sortBy (at least if you don't force the user to
> copy arrays before they can sort them in place)?


Type class *instances* are required to be statically resolvable constants.
Which is inherent, because they are statically defined and you have to have
the instance you want in your lexical scope to make use of it in the first
place.

As to sortBy, the answer is "yes and no". To get a reverse sort, the
*caller* may need to write something like:

using myOrdering sort Vector 'a


where myOrdering is a named instance of Ord 'a, and the "using" places it
first in the instance resolution order. But the author of "sort" no longer
needs to write two versions.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to