{-# LANGUAGE TypeFamilies #-}
module Text.Pandoc.Utils (
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 :: [c] -> String
toString = [c] -> String
forall a. a -> a
id
instance ToString Text where
toString :: Text -> String
toString = Text -> String
T.unpack
class IsString s => ToText s where
toText :: s -> Text
instance Char ~ c => ToText [c] where
toText :: [c] -> Text
toText = [c] -> Text
String -> Text
T.pack
instance ToText Text where
toText :: Text -> Text
toText = Text -> Text
forall a. a -> a
id
class IsText a where
fromText :: Text -> a
instance Char ~ c => IsText [c] where
fromText :: Text -> [c]
fromText = Text -> [c]
Text -> String
T.unpack
instance IsText Text where
fromText :: Text -> Text
fromText = Text -> Text
forall a. a -> a
id