yaftee-conduit-bytestring 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+41/−3 lines, 3 filesdep +higher-order-freer-monad
Dependencies added: higher-order-freer-monad
Files
- src/Control/Monad/Yaftee/Pipe/ByteString.hs +19/−1
- src/Control/Monad/Yaftee/Pipe/ByteString/Lazy.hs +19/−1
- yaftee-conduit-bytestring.cabal +3/−1
src/Control/Monad/Yaftee/Pipe/ByteString.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE ImportQualifiedPost #-}-{-# LANGUAGE BlockArguments, OverloadedStrings #-}+{-# LANGUAGE BlockArguments, LambdaCase, OverloadedStrings #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE RequiredTypeArguments #-} {-# LANGUAGE DataKinds #-}@@ -15,6 +15,10 @@ Pkg, + -- * FROM/TO++ from, to,+ -- * STANDARD INPUT/OUTPUT putStr, putStr',@@ -36,9 +40,11 @@ import Control.Monad.Yaftee.Pipe qualified as Pipe import Control.Monad.Yaftee.State qualified as State import Control.Monad.Yaftee.IO qualified as IO+import Control.Monad.HigherFreer qualified as F import Control.HigherOpenUnion qualified as U import Data.HigherFunctor qualified as HFunctor import Data.Bits+import Data.Maybe import Data.Bool import Data.ByteString qualified as BS import System.IO hiding (putStr, hPutStr)@@ -103,3 +109,15 @@ go n (w : ws) | n > 0 = (fromIntegral w .|.) . (`shiftL` 8) <$> go (n - 1) ws go _ _ = Nothing++from :: U.Member Pipe.P es => Int -> BS.ByteString -> Eff.E es i BS.ByteString ()+from _ "" = pure ()+from n s = Pipe.yield t >> from n d+ where (t, d) = BS.splitAt n s++to :: HFunctor.Tight (U.U es) => Eff.E (Pipe.P ': es) i BS.ByteString r -> Eff.E es i o BS.ByteString+to p = (fromJust <$>) . Pipe.run $ fromPure . snd <$> p Pipe.=$= fix \go ->+ Pipe.isMore >>= bool (pure "") (BS.append <$> Pipe.await <*> go)++fromPure :: F.H h i o a -> a+fromPure = \case F.Pure x -> x; _ -> error "not Pure"
src/Control/Monad/Yaftee/Pipe/ByteString/Lazy.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE ImportQualifiedPost #-}-{-# LANGUAGE BlockArguments, LambdaCase #-}+{-# LANGUAGE BlockArguments, LambdaCase, OverloadedStrings #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE RequiredTypeArguments #-} {-# LANGUAGE KindSignatures, TypeOperators #-}@@ -9,6 +9,10 @@ module Control.Monad.Yaftee.Pipe.ByteString.Lazy ( + -- * FROM/TO++ from, to,+ -- * HANDLE hGet, hGet', hPutStr, hPutStr',@@ -27,9 +31,11 @@ import Control.Monad.Yaftee.Pipe qualified as Pipe import Control.Monad.Yaftee.State qualified as State import Control.Monad.Yaftee.IO qualified as IO+import Control.Monad.HigherFreer qualified as F import Control.HigherOpenUnion qualified as U import Data.HigherFunctor qualified as HFunctor import Data.Bits+import Data.Maybe import Data.Bool import Data.Int import Data.ByteString qualified as BS@@ -93,3 +99,15 @@ go n (w : ws) | n > 0 = (fromIntegral w .|.) . (`shiftL` 8) <$> go (n - 1) ws go _ _ = Nothing++from :: U.Member Pipe.P es => Int64 -> LBS.ByteString -> Eff.E es i LBS.ByteString ()+from _ "" = pure ()+from n s = Pipe.yield t >> from n d+ where (t, d) = LBS.splitAt n s++to :: HFunctor.Tight (U.U es) => Eff.E (Pipe.P ': es) i LBS.ByteString r -> Eff.E es i o LBS.ByteString+to p = (fromJust <$>) . Pipe.run $ fromPure . snd <$> p Pipe.=$= fix \go ->+ Pipe.isMore >>= bool (pure "") (LBS.append <$> Pipe.await <*> go)++fromPure :: F.H h i o a -> a+fromPure = \case F.Pure x -> x; _ -> error "not Pure"
yaftee-conduit-bytestring.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: yaftee-conduit-bytestring-version: 0.1.0.0+version: 0.1.0.1 synopsis: Yaftee Conduit tools for ByteString description: Please see the README on GitHub at <https://github.com/YoshikuniJujo/yaftee-conduit-bytestring#readme> category: Control@@ -51,6 +51,7 @@ , base >=4.7 && <5 , bitarray-bs ==0.1.* , bytestring ==0.12.*+ , higher-order-freer-monad ==0.1.* , higher-order-open-union ==0.1.* , tools-yj ==0.1.* , typelevel-tools-yj ==0.1.*@@ -74,6 +75,7 @@ , base >=4.7 && <5 , bitarray-bs ==0.1.* , bytestring ==0.12.*+ , higher-order-freer-monad ==0.1.* , higher-order-open-union ==0.1.* , tools-yj ==0.1.* , typelevel-tools-yj ==0.1.*