Nitpick: Not sure about the naming here either.  `write_to_string` and `print_to_string` are really similar, and there's nothing in the name that indicates how they're different.  It would be great if they could use the same name, but since it's not obvious that `xs` can't contain functions, how about `print_to_string_f`.