Steps to propose a new primop in GHC

Mitsutoshi Aoe maoe at
Mon May 28 07:23:44 UTC 2018

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list