handle-like 0.0.0.1 → 0.0.0.2
raw patch · 2 files changed
+13/−7 lines, 2 files
Files
- handle-like.cabal +11/−7
- src/Data/HandleLike.hs +2/−0
handle-like.cabal view
@@ -2,7 +2,7 @@ build-type: Simple name: handle-like-version: 0.0.0.1+version: 0.0.0.2 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -16,12 +16,16 @@ A tiny package. It's contain the following class. . > class HandleLike h where- > hlPut :: h -> ByteString -> IO ()- > hlGet :: h -> Int -> IO ByteString- > hlGetByte :: h -> IO Word8- > hlGetLine :: h -> IO ByteString- > hlGetContent :: h -> IO ByteString- > hlClose :: h -> IO ()+ > type HandleMonad 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 ()+ > hlError :: h -> ByteString -> HandleMonad h ()++ Minimal complete difinition: hlPut, hlGet and hlClose. source-repository head type: git
src/Data/HandleLike.hs view
@@ -16,6 +16,7 @@ hlGetLine :: h -> HandleMonad h BS.ByteString hlGetContent :: h -> HandleMonad h BS.ByteString hlClose :: h -> HandleMonad h ()+ hlError :: h -> BS.ByteString -> HandleMonad h () hlGetByte h = do [b] <- BS.unpack `liftM` hlGet h 1; return b hlGetLine h = do@@ -24,6 +25,7 @@ 10 -> return "" _ -> BS.cons b `liftM` hlGetLine h hlGetContent = flip hlGet 1+ hlError = hlPut instance HandleLike Handle where type HandleMonad Handle = IO