module Foreign.Lua.Utf8
( toString
, toText
, fromString
, fromText
) where
import Data.ByteString (ByteString)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as TextEncoding
toString :: ByteString -> String
toString = T.unpack . TextEncoding.decodeUtf8
{-# INLINABLE toString #-}
toText :: ByteString -> Text
toText = TextEncoding.decodeUtf8
{-# INLINABLE toText #-}
fromString :: String -> ByteString
fromString = TextEncoding.encodeUtf8 . T.pack
{-# INLINABLE fromString #-}
fromText :: Text -> ByteString
fromText = TextEncoding.encodeUtf8
{-# INLINABLE fromText #-}