{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}


module Air.Data.PlainShow where

import Data.Text (Text, unpack)

class (Show a) => PlainShow a where
    plainShow :: a -> String

instance PlainShow String where 
  plainShow x = x

instance PlainShow Char where 
  plainShow x = [x]

instance PlainShow Text where
  plainShow = unpack

instance (Show a) => PlainShow a where 
  plainShow = show


newtype PlainShowWrapper a = PlainShowWrapper {unPlainShowWrapper :: a }
  deriving (Eq)

instance (PlainShow a) => Show (PlainShowWrapper a) where
  show (PlainShowWrapper x) = plainShow x