handle-like 0.0.0.9 → 0.0.0.10
raw patch · 2 files changed
+6/−2 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.HandleLike: hlFlush :: HandleLike h => h -> HandleMonad h ()
- Data.HandleLike: class (Monad (HandleMonad h), Num (DebugLevel h)) => HandleLike h where type family HandleMonad h type family DebugLevel h type instance DebugLevel h = Int hlGetByte h = do { [b] <- unpack `liftM` hlGet h 1; return b } hlGetLine h = do { b <- hlGetByte h; case b of { 10 -> return "" _ -> cons b `liftM` hlGetLine h } } hlGetContent = flip hlGet 1 hlDebug _ _ _ = return () hlError _ msg = error $ unpack msg
+ Data.HandleLike: class (Monad (HandleMonad h), Num (DebugLevel h)) => HandleLike h where type family HandleMonad h type family DebugLevel h type instance DebugLevel h = Int hlGetByte h = do { [b] <- unpack `liftM` hlGet h 1; return b } hlGetLine h = do { b <- hlGetByte h; case b of { 10 -> return "" _ -> cons b `liftM` hlGetLine h } } hlGetContent = flip hlGet 1 hlFlush _ = return () hlDebug _ _ _ = return () hlError _ msg = error $ unpack msg
Files
- handle-like.cabal +3/−2
- src/Data/HandleLike.hs +3/−0
handle-like.cabal view
@@ -2,7 +2,7 @@ build-type: Simple name: handle-like-version: 0.0.0.9+version: 0.0.0.10 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -23,6 +23,7 @@ > hlGetByte :: h -> HandleMonad h Word8 > hlGetLine :: h -> HandleMonad h ByteString > hlGetContent :: h -> HandleMonad h ByteString+ > hlFlush :: h -> HandleMonad h () > hlClose :: h -> HandleMonad h () > hlDebug :: h -> DebugLevel h -> HandleMonad h () > hlError :: h -> ByteString -> HandleMonad h a@@ -37,7 +38,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/forest- tag: handle-like-0.0.0.9+ tag: handle-like-0.0.0.10 library hs-source-dirs: src
src/Data/HandleLike.hs view
@@ -17,6 +17,7 @@ hlGetByte :: h -> HandleMonad h Word8 hlGetLine :: h -> HandleMonad h BS.ByteString hlGetContent :: h -> HandleMonad h BS.ByteString+ hlFlush :: h -> HandleMonad h () hlClose :: h -> HandleMonad h () hlDebug :: h -> DebugLevel h -> BS.ByteString -> HandleMonad h () hlError :: h -> BS.ByteString -> HandleMonad h a@@ -29,6 +30,7 @@ 10 -> return "" _ -> BS.cons b `liftM` hlGetLine h hlGetContent = flip hlGet 1+ hlFlush _ = return () hlDebug _ _ _ = return () hlError _ msg = error $ BSC.unpack msg @@ -40,6 +42,7 @@ hlGetLine = (chopCR `liftM`) . BS.hGetLine -- hlGetContent = flip BS.hGet 1 hlDebug _ _ = BS.hPutStr stderr+ hlFlush = hFlush hlClose = hClose hlPutStrLn :: HandleLike h => h -> BS.ByteString -> HandleMonad h ()