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

Evan Laforge qdunkan at gmail.com
Thu Feb 5 00:10:56 UTC 2015


On Wed, Feb 4, 2015 at 3:51 PM, Eric Seidel <eric at seidel.io> wrote:
> Yep, my original motivation was getting access to source locations
> within embedded DSLs. The call-stack is a nice and easy extension, but
> I'm not sure how useful it will be in practice, as the first function
> that doesn't request a CallStack parameter will cut off the stack. This
> means that the generated stacks will often be quite short, I imagine.

Well, as I said, all I really care about is the direct caller.  From
the example in the commit, it looks like the function with the (?x ::
Location) annotation can get its immediate caller, even if that caller
doesn't have the annotation.  If that's true, that's all that is
needed!

And from my point of view, it's not just "maybe useful in practice",
but absolutely required, to the point where I wrote a custom
preprocessor for it.  I've been using it for 6 or 7 years and I sort
of forgot that other people don't have it.  I actually have no idea
how other people do logging... just hope the message is unique and
grep -n all the time?  And for tests, manually give every single
assertion a unique name and grep -n again?  Enable TH globally?  Those
all seem impractical if you have or are expecting thousands of
modules.

I don't think it needs to be used at all in the standard libraries,
since logging and testing are not part of base.  I can understand if
the merge window for 7.10 is closed, but trying to come up with a use
in base shouldn't hold it up!


More information about the Haskell-Cafe mailing list