Giter Site home page Giter Site logo

concurrent-machines's People

Contributors

acowley avatar kozross avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

concurrent-machines's Issues

'buffer' and 'rolling' don't fill their buffers

I've done some graphing of processes using buffer and bufferConnect and noticed some strange behaviour.

source [1..32] ~> bufferConnect 5 (worker (*2) 1 2) (worker id 2 4)

buffering1-par splot

So bufferConnect does what I'd expect which is run as much as it can until it's got 5 items buffered, and then only run when downstream takes an item.

source [1..32] ~> buffer 5 (worker (*2) 1 2) ~> worker id 2 4

buffering2-par splot

But buffer doesn't seem to do the same, it only buffers one item and waits until it empties completely before a new item is forced, which makes downstream wait. The same difference exists between rollingConnect and rolling too.

source [1..32] ~> rollingConnect 5 (worker (*2) 1 2) (worker id 2 4)

rolling1-par splot

source [1..32] ~> rolling 5 (worker (*2) 1 2) ~> worker id 2 4

rolling2-par splot

worker takes a function a -> b, an id number, and a delay for threadDelay, so nothing special.

(Plots were done with splot).

Concurrent connect (>~>) misses the last await

If I have a construct

x <- await <|> yield something *> stop

This does not give deterministic result. Sometime it misses the last yield, skips the value. As a result last iteration is skipped.

The problem is usually with above construct.

mergeProd like capability

Hello,

I've been trying to accomplish a small program using Conduit, Pipes, Machines, and now Concurrent-Machines. I thought I'd finally found the solution with splitProd, but I now find I really need something more like mergeProd:

ProcessT m a r -> ProcessT m b r -> ProcessT m (a, b) r

I want to be able to split a source in two, perform different processes on each side (possibly in lock-step), and then merge the results, either automatically with a tuple, or manually with another Process argument.

It doesn't even really need concurrency support as far as I can tell, but the closest thing to what I've been looking for seems to be splitProd so I thought it couldn't hurt to ask if it falls under the scope of concurrent-machines here.

Feel free to close the issue if it's misplaced!

compile failures with GHC 7.8 and 7.6

Easiest fix: change lower bound to base >= 4.8

GHC 7.8 fails with

Configuring component lib from concurrent-machines-0.2.3.2
Preprocessing library concurrent-machines-0.2.3.2...
[1 of 8] Compiling Data.Machine.Regulated ( src/Data/Machine/Regulated.hs, /tmp/matrix-worker/1482362213/dist-newstyle/build/x86_64-linux/ghc-7.8.4/concurrent-machines-0.2.3.2/build/Data/Machine/Regulated.o )
[2 of 8] Compiling Data.Machine.Concurrent.AsyncStep ( src/Data/Machine/Concurrent/AsyncStep.hs, /tmp/matrix-worker/1482362213/dist-newstyle/build/x86_64-linux/ghc-7.8.4/concurrent-machines-0.2.3.2/build/Data/Machine/Concurrent/AsyncStep.o )
[3 of 8] Compiling Data.Machine.Concurrent.Buffer ( src/Data/Machine/Concurrent/Buffer.hs, /tmp/matrix-worker/1482362213/dist-newstyle/build/x86_64-linux/ghc-7.8.4/concurrent-machines-0.2.3.2/build/Data/Machine/Concurrent/Buffer.o )

src/Data/Machine/Concurrent/Buffer.hs:34:51:
    Could not deduce (Functor m) arising from a use of ‘<$>’
    from the context (Monad m)
      bound by the type signature for
                 drain :: Monad m =>
                          MachineStep m k a
                          -> (MachineStep m k a -> m (MachineStep m k' a))
                          -> m (MachineStep m k' a)
      at src/Data/Machine/Concurrent/Buffer.hs:(28,10)-(31,31)
    Possible fix:
      add (Functor m) to the context of
        the type signature for
          drain :: Monad m =>
                   MachineStep m k a
                   -> (MachineStep m k a -> m (MachineStep m k' a))
                   -> m (MachineStep m k' a)
    In the expression: Yield o . MachineT . go <$> runMachineT kd
    In an equation for ‘go’:
        go (Yield o kd) = Yield o . MachineT . go <$> runMachineT kd
    In an equation for ‘drain’:
        drain z k
          = go z
          where
              go Stop = return Stop
              go (Yield o kd) = Yield o . MachineT . go <$> runMachineT kd
              go aStep = k aStep

whereas GHC 7.6 fails with

Configuring component lib from concurrent-machines-0.2.3.2
Preprocessing library concurrent-machines-0.2.3.2...

src/Data/Machine/Concurrent/Fanout.hs:18:8:
    Could not find module `Data.Coerce'
    Use -v to see a list of the files searched for.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.