[Haskell-cafe] Re: Overloading functions based on arguments?
John A. De Goes
john at n-brain.net
Fri Feb 13 15:48:07 EST 2009
On Feb 13, 2009, at 1:38 PM, Daniel Fischer wrote:
> ? Well, still easy, we must unify with (a -> b) -> c -> [d], only one
> possibility, fine. Or is it? What if we have another 'take' in scope?
> Say take :: Int -> Set a -> Set a ? Oops.
> So, where draw the line?
You draw the line exactly when you cannot perform unambiguous typing.
> Bottom line, allowing that sort of overloading would at least be very
> ad-hoccish, and probably a bad thing.
Why? All existing programs would type check and run without
modification. So if you really like type class abuse and a billion
pseudonyms for '+' (among others), then you would still have the
option of developing in that style.
On the other hand, if you wanted the machine to do what a human can
(which is, deciding in completely unambiguous cases which of several
definitions to use), then you'd be able to use name overloading and
make some programs a lot more readable.
Regards,
John A. De Goes
N-BRAIN, Inc.
The Evolution of Collaboration
http://www.n-brain.net | 877-376-2724 x 101
More information about the Haskell-Cafe
mailing list