{-# LANGUAGE DefaultSignatures, FlexibleInstances #-}
module Little.Earley.Internal.Pretty where
class PrettyPrint a where
prettyPrint :: a -> String
default prettyPrint :: Show a => a -> String
prettyPrint = a -> String
forall a. Show a => a -> String
show
instance PrettyPrint Char where
prettyPrint :: Char -> String
prettyPrint = (Char -> String -> String
forall a. a -> [a] -> [a]
: [])
instance PrettyPrint String where
prettyPrint :: String -> String
prettyPrint = String -> String
forall a. a -> a
id
newtype Pretty a = Pretty a
instance PrettyPrint a => Show (Pretty a) where
show :: Pretty a -> String
show (Pretty a
a) = a -> String
forall a. PrettyPrint a => a -> String
prettyPrint a
a