[Haskell-cafe] Re: Is "take" behaving correctly?

Lutz Donnerhacke lutz at iks-jena.de
Thu Sep 13 08:49:29 EDT 2007


* Neil Mitchell wrote:
> There are 4 variants of tail:
>
> tail :: [a] -> [a] -- normal
> tailDef :: [a] -> [a] -> [a] -- returns the first argument on []
> tailMay :: [a] -> Maybe [a] -- returns a Nothing
> tailNote :: String -> [a] -> [a] -- crashes, but with a helpful message
> tailSafe :: [a] -> [a] -- returns [] on []

>From the logical point of view tailMay is the right one.
It pushes the error handling to the caller programm.

tail = fromJust . tailMay


More information about the Haskell-Cafe mailing list