Steps to propose a new primop in GHC

Ben Gamari ben at smart-cactus.org
Tue May 29 20:33:57 UTC 2018


Mitsutoshi Aoe <maoe at foldr.in> writes:

> Hi devs,
>
> I'm thinking to add a primop in GHC but not sure how I should proceed. The
> primop I have in mind is something like:
>
>   traceEventBinary# :: Addr# -> Int# -> State# s -> State# s
>
> This function is similar to the existing traceEvent# but it takes a chunk
> of bytes rather than a null-terminated string. It is useful to trace custom
> user events (e.g. network packet arrival timestamps in an network
> application) in eventlogs. At library level, it is supposed to be used like
> the tracing functions in Debug.Trace but with ByteString argument:
>
>   traceEventBinary :: ByteString -> a -> a
>   traceEventBinaryIO :: ByteString -> IO ()
>
> Note that this can't live in base because of the dependency on bytestring.
>
> So how should I proceed from here? Am I supposed to submit a GHC proposal
> or should I ask on the libraries list? This is not a prominently visible
> change in GHC. It rather affects only ghc-prim and no effects in base.
>
Hmm, that is a good question. I have also needed something like your
traceEventBinary# in the past and I think adding the primop is rather
non-controversial.

As far as adding a wrapper in `base`, I think we can just go ahead and
do it. `Debug.Trace` module isn't defined by the Haskell Report so I
don't think there's a need to involve the CLC here.

Cheers,

- Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180529/2f54c2b4/attachment.sig>


More information about the ghc-devs mailing list