Difference Argument Order
ajb at spamcop.net
ajb at spamcop.net
Sun May 22 22:21:30 EDT 2005
G'day all.
Quoting Ashley Yakeley <ashley at semantic.org>:
> Which of these argument orders is more intuitive to you?
This one:
> 2. This one is more familiar for the English language and for the
> standard operators:
>
> add :: Absolute -> Diff -> Absolute
> add a d = a + d
> subtract :: Absolute -> Diff -> Absolute
> subtract a d = a - d
> diff :: Absolute -> Absolute -> Diff
> diff a b = a - b
But even better would be if you could do both, and not distinguish between
subtract and diff:
class Add a b c | a b -> c where
add :: a -> b -> c
class Subtract a b c | a b -> c where
subtract :: a -> b -> c
...you get the idea.
Cheers,
Andrew Bromage
More information about the Libraries
mailing list