[Haskell-cafe] HasCallStack - runtime costs?
anselm.scholl at tu-harburg.de
Mon Mar 7 18:02:55 UTC 2016
I think the documentation for HasCallStack is not quite correct. As far
as I understood, head and tail are not changed to contain call stacks as
this would indeed carry a performance-penalty. Maybe the documentation
should call the function myHead to distinguish it from the library
function. The user-manual also uses errorWithCallStack, but I think base
calls this function just error and adds errorWithoutStackTrace (at least
thats what I find in
On 03/07/2016 06:21 PM, Johannes Waldmann wrote:
> Eric wrote earlier:
>> If you import a function with a HasCallStack constraint
>> there's no way to disable the overhead ...
>> For non-recursive functions like head and tail,
>> the overhead is probably not large enough to be noticeable.
> Now I'm confused: should this mean that head and tail
> are "functions with a HasCallStack constraint"?
> If I ask ghci for their type, it just says head :: [a] -> a
> and that's also what's in the source
> but the Callstack explanation in the user manual
> does show a different version of head
> I am not particularly concerned about head and tail here
> but generally about how to find out whether my code
> is taking a performance penalty.
> I think the documentation (user manual Section 9.31)
> is rather brief about the semantics. It speaks about
> solving "HasCallStack" constraints - but they could also
> be propagated? There is secondary documentation like
> but it does not tell what is actually implemented,
> or I don't see it.
> - J.W.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 473 bytes
Desc: OpenPGP digital signature
More information about the Haskell-Cafe