X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fharbl.git;a=blobdiff_plain;f=src%2FNetwork%2FDNS%2FRBL%2FPretty.hs;fp=src%2FNetwork%2FDNS%2FRBL%2FPretty.hs;h=0000000000000000000000000000000000000000;hp=23a285c60a05a9a7ba371d30c8bc3e37bd8a8a85;hb=b55e5db2a68be5d69b970bbe4b5ad447881abd3d;hpb=c4d41b93ec02ff4dc762163441ebefb0324e6f07 diff --git a/src/Network/DNS/RBL/Pretty.hs b/src/Network/DNS/RBL/Pretty.hs deleted file mode 100644 index 23a285c..0000000 --- a/src/Network/DNS/RBL/Pretty.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} - --- | A typeclass for pretty-printing. Types that wish to be --- pretty-printed should make themselves an instance of the 'Pretty' --- class. The only class function that they need to implement is --- 'pretty_show', which turns the thing into a string in a nice --- way. The 'pretty_print' function then prints the result of --- 'pretty_show' by default. --- -module Network.DNS.RBL.Pretty ( Pretty(..) ) -where - -import Text.Parsec ( ParseError ) - - -class Pretty a where - -- | Obtain a pretty 'String' representation of the given thingy. - pretty_show :: a -> String - - -- | Pretty-print the given thingy. - pretty_print :: a -> IO () - pretty_print = putStrLn . pretty_show - - --- | If we can pretty print something, we can pretty-print a list of --- them too. --- -instance (Pretty a) => Pretty [a] where - pretty_show l = show $ map pretty_show l - - --- | If we can pretty print something, we can pretty-print a pair of --- them too. --- -instance (Pretty a, Pretty b) => Pretty (a,b) where - pretty_show (x,y) = show (pretty_show x, pretty_show y) - - - --- | Define a 'Pretty' instance for the result of 'parse'. This lets --- us pretty-print the result of a parse attempt without worrying --- about whether or not it failed. If the parse failed, you get the --- same output that you usually would. Otherwise we pretty-print the --- parsed value. --- -instance Pretty a => Pretty (Either ParseError a) where - pretty_show (Left err) = show err - pretty_show (Right v) = pretty_show v