<html>
<body>
<font size=3>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 <br>
take n [] = [] where n &gt; 0<br>
taking n from nothing, or the empty set, returns nothing!<br>
The same should apply to head and tail. head or tail&nbsp; of [] should
be [].<br><br>
What does the list think?<br>
Cheers, Paul<br>
At 16:43 12/09/2007, you wrote:<br>
<blockquote type=cite class=cite cite="">Hi<br><br>
On 12 Sep 2007, at 11:44, ChrisK wrote:<br><br>
<blockquote type=cite class=cite cite="">Conor McBride wrote:<br>
<blockquote type=cite class=cite cite="">I'd like operations to
complain<br>
about bogus input, rather than producing bogus output.<br>
</blockquote><br>
Then you want a runtime assertion checking error helpful Data.List&nbsp;
<br>
replacement.<br><br>
Could you use Control.Exception.assert and make a wrapper for&nbsp; <br>
Data.List?<br><br>
<a href="http://www.haskell.org/ghc/docs/latest/html/users_guide/sec" eudora="autourl">
http://www.haskell.org/ghc/docs/latest/html/users_guide/sec</a>-
assertions.html</blockquote><br>
Hmmm. It might be quite annoying to make it a wrapper if it's just
a&nbsp; <br>
question<br>
of appealing to error rather than returning dummy values in failure&nbsp;
<br>
cases.<br>
Defining the domain of a function can be quite like defining the&nbsp;
<br>
function<br>
itself. Also, sometimes there can be problems arriving at a Bool.
For&nbsp; <br>
example,<br>
zipping colists is a productive coprogram, and it can raise errors
in<br>
off-diagonal cases, but you can't compute in advance whether you're&nbsp;
<br>
on the<br>
diagonal.<br><br>
A more serious point is that in some cases we might want take to<br>
underapproximate, or zip to truncate (or tail [] = [] ?). I don't&nbsp;
<br>
think there's<br>
always a clear &quot;library&quot; choice here. I tend to be pragmatic
about&nbsp; <br>
it. I was<br>
just pointing out that it does sometimes make sense to use less
defined<br>
functions when one has a more specific domain in mind. I'm usually&nbsp;
<br>
happy to<br>
write the fussy variants myself, if I'm that agitated.<br><br>
Funny old world<br><br>
Conor<br><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
Haskell-Cafe@haskell.org<br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" eudora="autourl">
http://www.haskell.org/mailman/listinfo/haskell-cafe</a></font>
</blockquote></body>
</html>