Proposal: Debug.Trace.traceWith

David Feuer david.feuer at gmail.com
Sat Feb 10 17:10:34 UTC 2018


Also, if you're pretty-printing something to use with trace, show will
knock off the alignment and such.

On Feb 10, 2018 12:09 PM, "David Feuer" <david.feuer at gmail.com> wrote:

> On Feb 10, 2018 11:53 AM, "Kris Nuttycombe" <kris.nuttycombe at gmail.com>
> wrote:
>
>
> On Fri, Feb 9, 2018 at 7:07 PM, David Feuer <david.feuer at gmail.com> wrote:
>
>> Other another bike-shed color:
>>
>> traceWith :: (a -> String) -> a -> a
>> traceWith f a = trace (f a) a
>>
>> traceShowWith :: Show b => (a -> b) -> a -> a
>> traceShowWith f = traceWith (show . f)
>>
>
> Is there some situation where the `Show String` instance wouldn't be in
> scope? If `b` is `String` it works out just fine, so the first definition
> you gave here seems superfluous.
>
>
> If the strings have non-ASCII characters, show will mangle them.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180210/4e1dd143/attachment-0001.html>


More information about the Libraries mailing list