handle-like 0.0.0.7 → 0.0.0.8
raw patch · 2 files changed
+10/−6 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.HandleLike: class Monad (HandleMonad h) => HandleLike h where type family HandleMonad h 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) => 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: hlDebug :: HandleLike h => h -> ByteString -> HandleMonad h ()
+ Data.HandleLike: hlDebug :: HandleLike h => h -> DebugLevel h -> ByteString -> HandleMonad h ()
Files
- handle-like.cabal +5/−3
- src/Data/HandleLike.hs +5/−3
handle-like.cabal view
@@ -2,7 +2,7 @@ build-type: Simple name: handle-like-version: 0.0.0.7+version: 0.0.0.8 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -17,16 +17,18 @@ . > class HandleLike h where > type HandleMonad h+ > type DebugLevel h > hlPut :: h -> ByteString -> HandleMonad h () > hlGet :: h -> Int -> HandleMonad h ByteString > hlGetByte :: h -> HandleMonad h Word8 > hlGetLine :: h -> HandleMonad h ByteString > hlGetContent :: h -> HandleMonad h ByteString > hlClose :: h -> HandleMonad h ()+ > hlDebug :: h -> DebugLevel h -> HandleMonad h () > hlError :: h -> ByteString -> HandleMonad h a . - Minimal complete difinition: hlPut, hlGet and hlClose.+ Minimal complete difinition: HandleMonad, hlPut, hlGet and hlClose. source-repository head type: git@@ -35,7 +37,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/forest- tag: handle-like-0.0.0.7+ tag: handle-like-0.0.0.8 library hs-source-dirs: src
src/Data/HandleLike.hs view
@@ -10,15 +10,17 @@ class Monad (HandleMonad h) => HandleLike h where type HandleMonad h+ type DebugLevel h hlPut :: h -> BS.ByteString -> HandleMonad h () hlGet :: h -> Int -> HandleMonad h BS.ByteString hlGetByte :: h -> HandleMonad h Word8 hlGetLine :: h -> HandleMonad h BS.ByteString hlGetContent :: h -> HandleMonad h BS.ByteString hlClose :: h -> HandleMonad h ()- hlDebug :: h -> BS.ByteString -> HandleMonad h ()+ hlDebug :: h -> DebugLevel h -> BS.ByteString -> HandleMonad h () hlError :: h -> BS.ByteString -> HandleMonad h a + type DebugLevel h = Int hlGetByte h = do [b] <- BS.unpack `liftM` hlGet h 1; return b hlGetLine h = do b <- hlGetByte h@@ -26,7 +28,7 @@ 10 -> return "" _ -> BS.cons b `liftM` hlGetLine h hlGetContent = flip hlGet 1- hlDebug _ _ = return ()+ hlDebug _ _ _ = return () hlError _ msg = error $ BSC.unpack msg instance HandleLike Handle where@@ -36,7 +38,7 @@ -- hlGetByte h = do [b] <- BS.unpack <$> BS.hGet h 1; return b hlGetLine = (chopCR `liftM`) . BS.hGetLine -- hlGetContent = flip BS.hGet 1- hlDebug _ = BS.hPutStr stderr+ hlDebug _ _ = BS.hPutStr stderr hlClose = hClose hlPutStrLn :: HandleLike h => h -> BS.ByteString -> HandleMonad h ()