implemented decodeUTF8

This commit is contained in:
jlamothe committed 2022-04-19 19:21:15 -04:00
1 parent 08c77d4d0f
commit eea4710b80
2 files changed
+21 -3

No files matched your search

+4 -1
View File
@@ -35,6 +35,7 @@ import Conduit (ConduitT, mapC, (.|))
import qualified Data.ByteString as BS
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8')
-- | decode the rows from a stream of ByteStrings
decodeRows :: Monad m => ConduitT BS.ByteString [T.Text] m ()
@@ -46,6 +47,8 @@ decodeRawRows = return ()
-- | decode a raw ByteString into Text (if possible)
decodeUTF8 :: BS.ByteString -> Maybe T.Text
decodeUTF8 = const Nothing
decodeUTF8 bs = case decodeUtf8' bs of
Left _ -> Nothing
Right txt -> Just txt
--jl