ghc-say Send textual messages to a Handle in a thread-friendly way

A thread safe API to write a line of textual data to a Handle, such as sending some messages to the terminal - that has the following properties:

  • Properly handle character encoding settings on the Handle

  • For reasonably sized messages, ensure that the entire message is written in one chunk to avoid interleaving data with other threads

  • Avoid unnecessary memory allocations and copies

  • Minimize locking.