[Haskell-cafe] fromString and toString

Dmitry Dzhus dima at dzhus.org
Tue Feb 4 14:03:39 UTC 2014

04.02.2014, 17:55, "Ben Foppa" <benjamin.foppa at gmail.com>:
> 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).

There's more than one way to interpret a ByteString as a String/Text
and vice versa. If reString exists, what would you expect it to do
when called with a ~ ByteString and b ~ Text?

More information about the Haskell-Cafe mailing list