On Fri, May 1, 2015 at 7:54 AM, Keean Schupke <[email protected]> wrote:
> I watched the video (finally), and I disagree (but I could be persuaded),
> why should I have to declare both:
>
> sort :: Ord a => [a] -> [a] -> [a]
>
> sort :: (a -> a -> Bool) -> [a] -> [a] -> [a]
How come your sort takes two lists?
> For me the purpose of implicits is to increase generality by declaring only:
>
> sort :: {Ord a} -> [a] -> [a] -> [a]
>
> Which can be used both ways.
Yes, instance arguments are great for sort. Sort does not care what
order you give it, since the input list is not assumed to be in order
anyway.
> I don't here anyone arguing for type-classes over implicits saying they want
> to remove first-class functions, but this would actually be the logical
> conclusion of saying type classes with global instance coherence are better
> than implicits?
Bull crap. As you said yourself, with coherent typeclasses, you may
want alternatives that take an explicit comparison function. So with
coherent typeclasses, you certainly want first-class functions too.
Since typeclasses generally require passing dictionaries, you already
effectively have first-class functions anyway, whether you like it or
not. But really, who wants to get rid of first-class functions? No
one. So don't write flame bait.
The one and only problem with instance arguments, I gather, is that
instances are not guaranteed to be coherent. What I think William
wants is instance arguments, but where _some_ typeclasses are
guaranteed to have coherent instances. This sounds good: use coherent
instances for prototyping, before you know where your operations
really belong, then switch to something modular as the code matures.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev