gdritter repos endsay / master src / Pretty.hs
master

Tree @master (Download .tar.gz)

Pretty.hs @masterraw · history · blame

module Pretty where

import           Data.Monoid ((<>))
import qualified Data.Text as T
import qualified Data.Text.IO as T

class PSShow t where
  psShow :: t -> Text

instance PSShow Object where
  psShow (OBool True) = "true"
  psShow (OBool False) = "false"
  psShow (OInteger i) = "0"
  psShow (OString t) = "(" <> t <> ")"

psPrint :: PSShow t => t -> IO ()
psPrint = T.putStrLn . psShow