I know we have

class IsString a where
    fromString :: String -> a

But do we have an inverse generic function toString defined anywhere? IsString implies that the type `a` is a subset of String; if all we have is fromString, then IsString defines supersets of String. To me, the most logical thing would be that IsString defines bijections to String (i.e. things that are subsets and supersets).

The reason this came up is that I'm getting pretty sick of type-juggling different string types from different libraries (String, Text, various ByteStrings), especially since I have to tweak all the functions I use if a type changes; discovering fromString was fantastic, but without toString, I can't define something like

reString :: (IsString a, IsString b) => a -> b

which is great to have if your putStrLn only accepts one kind of string, and you have several distinct ones floating around.

Thanks,
Ben