import "JavaBuiltin" as Java importJava "java.io.Writer" where data Writer importJava "java.io.StringWriter" where data StringWriter @JavaName "" createStringWriter :: StringWriter @JavaName toString resultOfStringWriter :: StringWriter -> String class WriterLike a where toWriter :: a -> Writer instance WriterLike StringWriter where toWriter = Java.unsafeCoerce