[Haskell-cafe] fromString and toString

Patrick Pelletier code at funwithsoftware.org
Thu Feb 20 07:15:16 UTC 2014


On 2/4/14, 5:55 AM, Ben Foppa wrote:

> 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.

Although it doesn't seem to be used much, I noticed that there's this 
package on Hackage:

http://hackage.haskell.org/package/stringable-0.1.2/docs/Data-Stringable.html

which seems like it's addressing the same problem you're trying to solve.

--Patrick



More information about the Haskell-Cafe mailing list