module Texts.Types where
import qualified Data.Text as T
import qualified Data.Text.Lazy as L
type LText = L.Text
type SText = T.Text
class ToText a where
toText :: a -> SText
toLazyText :: a -> LText
instance ToText SText where
toText = id
toLazyText = L.fromStrict
instance ToText String where
toText = T.pack
toLazyText = L.pack
class FromText a where
fromText :: SText -> Maybe a
fromLazyText :: LText -> Maybe a
instance FromText String where
fromText = Just . T.unpack
fromLazyText = Just . L.unpack