I want something that looks like a file handle but is really backed by an in-memory buffer to use for I/O redirects. How can I do this?
It's not possible without modifying the compiler. This is because Handle is an abstract data type, not a typeclass.