Proposal: add HasCallStack for all partial functions in base
LuoChen
luochen1990 at gmail.com
Mon Jun 17 14:06:00 UTC 2019
I have just confirmed that we can specify HasCallStack separately for
different instance of same typeclass, and here
<https://gist.github.com/luochen1990/bc556d0fc6a1355e5d1bd27a81114870> is
the test code.
Oliver Charles <ollie at ocharles.org.uk> 于2019年6月17日周一 上午3:02写道:
> Surely then the call stack is only foldr1, and not foldr1's callsite?
>
> On Sun, 16 Jun 2019, 8:27 pm Henning Thielemann, <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Sun, 16 Jun 2019, Simon Jakobi wrote:
>>
>> > > I think only the partial implementations should get that constraint.
>>
>> > Oops, I had the misconception that one couldn't add a HasCallStack
>> > constraint to method implementations.
>>
>> I think you have to declare:
>>
>> instance Foldable [] where
>> foldl1 = foldl1List
>>
>> foldl1List :: HasCallStack => (a->a->a) -> [a] -> a
>> foldl1List = ...
>>
>> Would this work?_______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190617/52b576a8/attachment.html>
More information about the Libraries
mailing list