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]

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.

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?


Keean.



Keean.



On 1 May 2015 at 05:58, Keean Schupke <[email protected]> wrote:

> Sorry, typing code on a phone:
>
> On 1 May 2015 05:48, "Keean Schupke" <[email protected]> wrote:
>
> > data Set order element = S order [element]
> >
> > data Ord o = O o {
> >     cmp :: x -> y -> Bool
> > }
>
> Except this needed to be a type class:
>
> class Ord x where
>     cmp :: x -> a -> a -> Bool
>
> > data AscendingNumeric = AN
> >
> > oan = O AN {
> >    cmp _ = <
> > }
>
> instance Ord AN where
>     cmp = >
> >
> > union :: Set o e -> Set o e -> Set o e
> > union (S cmp l1) (S _ l2) = ...
>
> union :: {Ord o} -> Set o e -> Set o e -> Set o e
> union (S o l1) (S _ l2) = ... (cmp o) x y ...
>
> >
> > set1 = S oan [1, 3, 5]
>
> set1 = S AN [1, 3, 5]
>
> > set2 = S oan [2, 4, 6]
>
> set2 = S AN [2, 4, 6]
>
> > set3 = union set1 set2
>
> Keean.
>
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to