On Wed, 12 Sep 2007, PR Stanley wrote:

I quite like the argument that take is a total function and as such all its return values are from teh specificed range. I can also see the logic in
take n [] = [] where n > 0
taking n from nothing, or the empty set, returns nothing!
The same should apply to head and tail. head or tail  of [] should be [].

Today you can use (drop 1) which has this property. However I consider it bad style that 'tail' and 'drop' behave so differently, and that one has to write (drop 1) when in fact (tailSafe) is meant. People reading (drop 1) in a program may assume, that the programmer was a newbie, who was not aware of 'tail'.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to