-
-class Pretty a where
- -- | Obtain a pretty 'String' representation of the given thingy.
- prettyshow :: a -> String
-
- -- | Pretty-print the given thingy.
- pp :: a -> IO ()
- pp = putStrLn . prettyshow
-
-
--- | 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
- prettyshow (Left err) = show err
- prettyshow (Right v) = prettyshow v