News for hackers. Stuff that matters.
Re:A Couple Million Lines of Haskell: Production Engineering... by singpolyma3 on Sunday May 03, 2026 @08:37AM (#47996354)
I have to sit with the specific example, but a PrintWriter struct which owns a Box<impl Writer> and has no generics should be quite doable I'd think?
Re:A Couple Million Lines of Haskell: Production Engineering... by Darmani on Sunday May 03, 2026 @08:45AM (#47996418)
*`dyn Writer`. `impl Writer` can only be used in function parameters.

This was one of the example approaches I gave. This works...at first. The problem is that, if you want to add a new function to the Writer trait which makes Writer no longer dyn-compatible, such as, say, any async function, then you can no longer write `Box<dyn Writer>` and need to rewrite all code that uses it.

(although you can dig under the hood and specify a pinned-down Future type, covering one kind of awfulness with another)