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

Ketil Malde ketil at ii.uib.no
Thu Sep 13 09:16:05 EDT 2007

On Thu, 2007-09-13 at 13:56 +0100, Neil Mitchell wrote:
> > tail = fromJust . tailMay
> The error messages suffer [..]
> That's why I supplied tailNote

Still, given tailMay, we have:

tailDef xs   = maybe xs id . tailMay
tailNote msg = tailDef (error msg)
tailSafe     = tailDef []
tail         = tailNote "tail: empty list"

which I suppose was Lutz's point?

(My rather ugly preference is to #define tail so that an error message
contains source code location.)


More information about the Haskell-Cafe mailing list