[Haskell-cafe] RFC: rewrite-with-location proposal

Evan Laforge qdunkan at gmail.com
Thu Feb 5 01:18:51 UTC 2015


On Wed, Feb 4, 2015 at 5:02 PM, Eric Seidel <eric at seidel.io> wrote:
> Right, it would also be useful for partial functions like head, so error has access to head's call-site when it produces a stack trace. The thing is, this feature is not free, as it adds an argument to each function that participates. So the question is, to what extent would you want to annotate library code with these CallStack parameters?

I don't actually care, since I never use those functions.

I suppose one way to argue would be to say go ahead and add, since the
only people using them are either a quick hack where crashing is ok,
and thus probably don't care about micro-optimizing performance, or
people who don't know any better, who are also not in the
micro-optimization business.

Or maybe people use them as a micro-optimization like e.g.
unsafeIndex.  But I don't know if it actually is a micro-optimization
over e.g. 'case xs of [] -> error "..."', since 'head' probably
compiles to just that.

In any case, I have no horse in the race, but I'd say "put it on
everything partial."


More information about the Haskell-Cafe mailing list