{-# LANGUAGE TypeFamilies #-}
module Text.Pandoc.Utils.String (
ToString (..),
ToText (..),
IsText (..),
IsString (..),
) where
import qualified Data.Text as T
import Data.String (IsString (..))
import Data.Text (Text)
class IsString s => ToString s where
toString :: s -> String
instance Char ~ c => ToString [c] where
toString = id
instance ToString Text where
toString = T.unpack
class IsString s => ToText s where
toText :: s -> Text
instance Char ~ c => ToText [c] where
toText = T.pack
instance ToText Text where
toText = id
class IsText a where
fromText :: Text -> a
instance Char ~ c => IsText [c] where
fromText = T.unpack
instance IsText Text where
fromText = id