blob: c25fe08901cfaf3dc8d25e6c2b383f9787bc585d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module HSVIS.Pretty where
import Data.Void
class Pretty a where
prettysPrec :: Int -> a -> ShowS
instance Pretty Void where
prettysPrec _ = absurd
instance (Pretty a, Pretty b) => Pretty (a, b) where
prettysPrec _ (x, y) =
showString "(" . prettysPrec 0 x . showString ", " . prettysPrec 1 y . showString ")"
prettyPrec :: Pretty a => Int -> a -> String
prettyPrec d x = prettysPrec d x ""
prettys :: Pretty a => a -> ShowS
prettys = prettysPrec 0
pretty :: Pretty a => a -> String
pretty x = prettyPrec minBound x
|