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

Evan Laforge qdunkan at gmail.com
Thu Feb 5 00:52:41 UTC 2015

On Wed, Feb 4, 2015 at 4:39 PM, Eric Seidel <eric at seidel.io> wrote:
> A constraint (?x :: CallStack) will always be solved for the source
> location that gave rise to it, when it comes from a function signature
> (as opposed to a use of the implicit param) you'll get the immediate
> call-site. Furthermore, if that call-site has a CallStack implicit param
> in scope, the stacks will be appended (this appending of call-stacks is
> the bit that I'm not sure will see much use). Does that make sense?

Sure.  One place I can think of where the chaining would be useful is
you can put it on a helper function that then calls the logging
function, so the output can skip that intermediate function.  This
makes it better than python or C++ logging, which often provides no
way to do that.

> You're quite right, there are plenty of reasons to want this
> functionality beyond error reporting, though I'd personally like to use
> this for `error`, `undefined`, and `assert` as well!

True enough, though assert kind of already has the feature.  In fact,
you could remove the assert special case hack, though there are
probably people relying on it to get source info.

In any case it's up to the GHC people to say what they think.  In case
it's not already obvious, big +1 for "merge as soon as possible" from

More information about the Haskell-Cafe mailing list