module Language.Haskell.LSP.Utility where
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString.Lazy.Char8 as B
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Encoding as TLE
import Language.Haskell.LSP.Constant
import System.Log.Logger
str2bs :: String -> BS.ByteString
str2bs = TE.encodeUtf8 . T.pack
bs2str :: BS.ByteString -> String
bs2str = T.unpack. TE.decodeUtf8
str2lbs :: String -> LBS.ByteString
str2lbs = TLE.encodeUtf8 . TL.pack
lbs2str :: LBS.ByteString -> String
lbs2str = TL.unpack. TLE.decodeUtf8
rdrop :: Int -> [a] -> [a]
rdrop cnt = reverse . drop cnt . reverse
logs :: String -> IO ()
logs s = debugM _LOG_NAME s
logm :: B.ByteString -> IO ()
logm str = logs (lbs2str str)