[Haskell-cafe] Alternate instance Show (Maybe a)?
ajb at spamcop.net
ajb at spamcop.net
Sun Feb 4 05:34:03 EST 2007
G'day all.
Quoting Sergey Zaharchenko <doublef-ctm at yandex.ru>:
> Yes, I think another Show-like class will probably be a better
> solution...
This is the one that I use. Very simple.
import Text.PrettyPrint.HughesPJ
class Pretty a where
-- Equivalent of showsPrec
prettyP :: Int -> a -> Doc
prettyP _ x = pretty x
-- Equivalent of shows
pretty :: a -> Doc
pretty x = prettyP 0 x
Cheers,
Andrew Bromage
More information about the Haskell-Cafe
mailing list