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