dynamic-pipeline 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+7/−28 lines, 2 filesdep −compdata
Dependencies removed: compdata
Files
- dynamic-pipeline.cabal +2/−7
- src/DynamicPipeline/Channel.hs +5/−21
dynamic-pipeline.cabal view
@@ -3,11 +3,9 @@ -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 2e2884da4e2f7061f9da8c7d81927267c84572f95b11abc020e0a49f506593ee name: dynamic-pipeline-version: 0.1.0.3+version: 0.1.0.4 synopsis: Library Type Safe implementation of Dynamic Pipeline Paradigm (DPP). description: @dynamic-pipeline@ is a __/Type Safe/__ Dynamic and Parallel Streaming Library, which is an implementation of __Dynamic Pipeline Paradigm (DPP)__ proposed in this paper [DPP](https://biblioteca.sistedes.es/articulo/the-dynamic-pipeline-paradigm/).@@ -100,7 +98,6 @@ , async >=2.1.0 && <=2.2.3 , base >=4.7 && <5 , bytestring >=0.10.9.0 && <=0.11.1.0- , compdata >=0.10 && <=0.12.1 , lens >=4.19 && <=5.0.1 , relude >=0.7.0.0 && <=1.0.0.1 , unagi-chan >=0.4.1.0@@ -156,7 +153,6 @@ , async , base >=4.7 && <5 , bytestring >=0.10.9.0 && <=0.11.1.0- , compdata >=0.10 && <=0.12.1 , dynamic-pipeline , lens >=4.19 && <=5.0.1 , optparse-applicative@@ -208,7 +204,7 @@ TypeApplications TypeOperators TypeFamilies- ghc-options: -Wall -fno-warn-partial-type-signatures -fconstraint-solver-iterations=0 -fspecialise-aggressively -fexpose-all-unfoldings -flate-specialise -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wno-unused-top-binds -Wno-unused-foralls -fno-warn-deprecations -fno-warn-orphans -threaded -O2 -rtsopts -with-rtsopts=-N -Wno-unused-local-binds -Wno-unused-matches+ ghc-options: -Wall -fno-warn-partial-type-signatures -fconstraint-solver-iterations=0 -fspecialise-aggressively -fexpose-all-unfoldings -flate-specialise -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wno-unused-top-binds -Wno-unused-foralls -fno-warn-deprecations -fno-warn-orphans -threaded -rtsopts -with-rtsopts=-N -Wno-unused-local-binds -Wno-unused-matches build-tool-depends: hspec-discover:hspec-discover build-depends:@@ -217,7 +213,6 @@ , async >=2.1.0 && <=2.2.3 , base >=4.7 && <5 , bytestring >=0.10.9.0 && <=0.11.1.0- , compdata >=0.10 && <=0.12.1 , dynamic-pipeline , hspec ==2.* , lens >=4.19 && <=5.0.1
src/DynamicPipeline/Channel.hs view
@@ -27,7 +27,6 @@ import Control.Concurrent.Chan.Unagi.NoBlocking import Control.Lens hiding ((<|)) import Data.ByteString as B-import Data.Comp.Algebra (CoalgM, anaM) import Data.Foldable as F import Data.HList import Relude as R@@ -79,22 +78,6 @@ -- -- [@a@]: Element get from some Source and to be write in some Channel ---{-# WARNING SourceFeedCoalgM "INTERNAL USE" #-}-data SourceFeedCoalgM m a = Done -- ^ Termination 'Term' of the Coalgebra- | Computation -- ^ Continuation 'Term' of the Coalgebra- { _cSeed :: m a -- ^ Computation that Seeds the /Anamorphism/ - , _cStop :: m Bool -- ^ Stop signal- , _cOnElem :: a -> m () -- ^ Computation on Read Element- }---- | 'SourceFeedCoalgM' in terms of 'CoalgM' -{-# WARNING sourceFeedCoalgM "INTERNAL USE" #-}-sourceFeedCoalgM :: MonadIO m => CoalgM m Maybe (SourceFeedCoalgM m a)-sourceFeedCoalgM Done = return Nothing-sourceFeedCoalgM c@Computation{..} = ifM _cStop - (return $ Just Done) - ( _cSeed >>= _cOnElem >> return (Just c) )- -- | unfold from a Monadic seed @m a@ to a 'WriteChannel' {-# INLINE unfoldM #-} unfoldM :: forall m a b. MonadIO m @@ -103,10 +86,11 @@ -> m Bool -- ^When stop unfolding -> WriteChannel b -- ^'WriteChannel' to write input seed elements -> m ()-unfoldM seed fn stopIfM writeChannel =- let onElem = flip push writeChannel . fn- in anaM sourceFeedCoalgM (Computation seed stopIfM onElem) >> pure ()-+unfoldM = loop' + where+ loop' seed fn stopIfM writeChannel = ifM stopIfM+ (pure ())+ (seed >>= flip push writeChannel . fn >> loop' seed fn stopIfM writeChannel) -- | Using 'unfoldM', unfold from file {-# INLINE unfoldFile #-} unfoldFile :: MonadIO m