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

Neil Mitchell ndmitchell at gmail.com
Thu Sep 13 06:03:42 EDT 2007


Hi

> Similarly, I expect foo and foo' to be equivalent, except for strictness
> properties, but perhaps an underscore could be used for slightly
> different behaviors (interpretations, as it were)?  "tail_" or "zip_",
> anyone?

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 []

tail_____ would not be a good name!

Thanks

Neil


More information about the Haskell-Cafe mailing list