[Haskell-cafe] Re: Is "take" behaving correctly?
prstanley at ntlworld.com
Wed Sep 12 12:08:21 EDT 2007
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 .
What does the list think?
At 16:43 12/09/2007, you wrote:
>On 12 Sep 2007, at 11:44, ChrisK wrote:
>>Conor McBride wrote:
>>>I'd like operations to complain
>>>about bogus input, rather than producing bogus output.
>>Then you want a runtime assertion checking error helpful Data.List
>>Could you use Control.Exception.assert and make a wrapper for
>Hmmm. It might be quite annoying to make it a wrapper if it's just a
>of appealing to error rather than returning dummy values in failure
>Defining the domain of a function can be quite like defining the
>itself. Also, sometimes there can be problems arriving at a Bool. For
>zipping colists is a productive coprogram, and it can raise errors in
>off-diagonal cases, but you can't compute in advance whether you're
>A more serious point is that in some cases we might want take to
>underapproximate, or zip to truncate (or tail  =  ?). I don't
>always a clear "library" choice here. I tend to be pragmatic about
>it. I was
>just pointing out that it does sometimes make sense to use less defined
>functions when one has a more specific domain in mind. I'm usually
>write the fussy variants myself, if I'm that agitated.
>Funny old world
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe