On Nov 7, 2007 4:34 PM, Nicholas Messenger <[EMAIL PROTECTED]> wrote:
> If you're willing to have an extra Typeable constraint, this does what you 
> want:
>
> > import Data.Typeable (Typeable, cast)
> > import Data.Maybe (fromMaybe)
> >
> > toString :: (Show a, Typeable a) => a -> String
> > toString x = fromMaybe (show x) (cast x)


Nice! Thank you for introducing me to the Typeable class (and by
extension, Dynamic) -- I hadn't realized there was library support for
dynamic types.

G
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to