[Haskell-cafe] Haskell - string to list isusses, and more

Jochem Berndsen jochem at functor.nl
Sun Jun 14 12:32:17 EDT 2009

Deniz Dogan wrote:
> 2009/6/14 Jochem Berndsen <jochem at functor.nl>:
>> Toby Miller wrote:
>>> caps1 s = all (\x -> isUpper (head x)) (words s)
>> This seems fine, but you need to check that words never returns a list
>> containing the empty string (otherwise `head' will fail).
> Is there any such case? I was thinking about that as well, but
> couldn't think of any case where head would be called on an empty
> list.

Not that I know of; but I tested this in order to make sure that I
didn't overlook something obvious. (At least, it's a potential issue
that we need to check, since `head' is partial.)


Jochem Berndsen | jochem at functor.nl

More information about the Haskell-Cafe mailing list