[Haskell-cafe] Type classes for converting to Text and String

Christopher Done chrisdone at googlemail.com
Thu Mar 8 11:00:34 CET 2012

On 8 March 2012 10:53, Simon Hengel <sol at typeful.net> wrote:
> When writing library code that should work with both String and Text I
> find my self repeatedly introducing classes like:
>    class ToString a where
>      toString :: a -> String
>    class ToText a where
>      toText :: a -> Text

Text is already an instance of IsString which provides IsString. I've
defined ToString in my own projects though, it would be nice for it to
be defined somewhere (Data.String maybe?).

More information about the Haskell-Cafe mailing list