Tue, 25 Jan 2000 12:14:29 -0500 (EST), Chris Okasaki <[EMAIL PROTECTED]> pisze:
> I would have no arguments with either approach, or with any other
> approach that makes Nat explicit in the type.
>
> But if the type *says* Int, then it should have reasonable behavior
> for ints.
I can't agree with that argument. What is a difference between "if the
type says [a], then it should have reasonable behavior for all lists"?
If it's in the definition of reasonable behavior, why tail [] being
undefined is reasonable where take (-1) [] is not?
It's good when a function is total, but types don't always allow to
nicely ensure this.
------------------------------------------------------------------------
Another similar case: cycle []. AFAIK it used to be [], but now it
is undefined. I don't have a strong opinion on either side, although
undefined looks a bit more natural: "cycle x = x ++ cycle x" without
exceptions. One could easily test for empty argument in constant
time anyway.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-