[Haskell-cafe] RFC: rewrite-with-location proposal
Eric Seidel
eric at seidel.io
Thu Feb 5 01:02:48 UTC 2015
> On Feb 4, 2015, at 16:52, Evan Laforge <qdunkan at gmail.com> wrote:
>
>> 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.
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?
More information about the Haskell-Cafe
mailing list