ThreadId gripe

Esa Ilari Vuokko eivuokko at gmail.com
Tue Aug 22 17:53:44 EDT 2006


On 8/22/06, Frederik Eaton <frederik at a5.repetae.net> wrote:
> The 'Show' instance for ThreadId produces stuff like "ThreadId 1" -
> not very concise. Is there an simple way to turn it into an Int or
> Integer so I can call 'show' on that? Usually ThreadId's are turned
> into strings for the purpose of logging, in which case one really only
> wants the numeric part.

With GHC, you can do it the same way as it's done in base lib (maybe
not the simple you'd like, and might break between versions):
http://darcs.haskell.org/packages/base/GHC/Conc.lhs

I do agree that the "ThreadId " part isn't that usefull.  Attached the trivial
patch to remove it from the Show instance, in case others agree.

Best regards,
--Esa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: base-threadid-show.dpatch
Type: text/x-darcs-patch
Size: 28353 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/libraries/attachments/20060823/d3e1ab8a/base-threadid-show-0001.bin


More information about the Libraries mailing list