Skip to content

Parallel composition of FixedStep clocks evaluates in unexpected order #365

@DISTEL100

Description

@DISTEL100

There seems to be a problem with the parallel clock when composing two pure clocks in ScheduleT. The merged output is not ordered by the timestamps.

The following is a minimal example to reproduce the issue:

f300 :: (MonadIO m) => Rhine (ScheduleT Integer m) (FixedStep 300) a Integer
f300 =  absoluteS @@ FixedStep

f500 :: (MonadIO m) => Rhine (ScheduleT Integer m) (FixedStep 500) a Integer
f500 =  absoluteS @@ FixedStep

f :: IO ()
f = runScheduleIO $ flow $ (f300 +@+ f500) @>-^ arrM (liftIO . print)

The output is:

ghci> f
Left 300
Left 600
Right 500
Left 900
Left 1200
Right 1000
Left 1500
Left 1800
Right 1500
Left 2100
Left 2400
Right 2000
Left 2700
Right 2500
Left 3000
Left 3300
^CInterrupted.

I would expect it to be

ghci> f
Left 300
Right 500
Left 600
Left 900
Right 1000
Left 1200
Left 1500
Right 1500
Left 1800
Right 2000
Left 2100
Left 2400
Right 2500
Left 2700
Left 3000
Left 3300
^CInterrupted.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions