txt 0.0.2.1 → 0.0.3.0
raw patch · 3 files changed
+59/−1 lines, 3 files
Files
- Data/Text/IO.hs +28/−0
- Data/Text/Lazy/IO.hs +28/−0
- txt.cabal +3/−1
+ Data/Text/IO.hs view
@@ -0,0 +1,28 @@+module Data.Text.IO where++import qualified Data.ByteString as BS+import Data.Text as T+import Data.Text.Private+import System.IO (Handle, stdin, stdout)++put, putLn :: Text -> IO ()+put = hPut stdout+putLn = hPutLn stdout++getContents :: IO Text+getContents = hGetContents stdin++hGet :: Handle -> Int -> IO Text+hGet h n = Text <$> BS.hGet h n++hGetContents :: Handle -> IO Text+hGetContents h = Text <$> BS.hGetContents h++hPut, hPutLn :: Handle -> Text -> IO ()+hPut h = BS.hPut h . unText+hPutLn h t+ | T.length t < 0x400 = hPut h (t `snoc` '\n')+ | otherwise = hPut h t *> hPut h "\n"++hPutNonBlocking :: Handle -> Text -> IO Text+hPutNonBlocking h = fmap Text . BS.hPutNonBlocking h . unText
+ Data/Text/Lazy/IO.hs view
@@ -0,0 +1,28 @@+module Data.Text.Lazy.IO where++import qualified Data.ByteString.Lazy as BS+import Data.Text.Lazy as T+import Data.Text.Lazy.Private+import System.IO (Handle, stdin, stdout)++put, putLn :: Text -> IO ()+put = hPut stdout+putLn = hPutLn stdout++getContents :: IO Text+getContents = hGetContents stdin++hGet :: Handle -> Int -> IO Text+hGet h n = Text <$> BS.hGet h n++hGetContents :: Handle -> IO Text+hGetContents h = Text <$> BS.hGetContents h++hPut, hPutLn :: Handle -> Text -> IO ()+hPut h = BS.hPut h . unText+hPutLn h t+ | T.length t < 0x400 = hPut h (t `snoc` '\n')+ | otherwise = hPut h t *> hPut h "\n"++hPutNonBlocking :: Handle -> Text -> IO Text+hPutNonBlocking h = fmap Text . BS.hPutNonBlocking h . unText
txt.cabal view
@@ -1,5 +1,5 @@ name: txt-version: 0.0.2.1+version: 0.0.3.0 synopsis: Text -- description: license: BSD3@@ -15,7 +15,9 @@ library hs-source-dirs: . exposed-modules: Data.Text+ , Data.Text.IO , Data.Text.Lazy+ , Data.Text.Lazy.IO other-modules: Data.Text.Lazy.Private , Data.Text.Private build-depends: base >= 4.7 && < 5