Parallel share combinator reading only one side
I would like to create a share that has the following properties:
- Reading the share gives the DateTime of the time of writing and the written value
- Writing the share automatically writes the current DateTime to the underlying share
- Notifications only occur when the share is written to, not when the current DateTime updates.
And while preserving the parameter of the original share. i.e.:
stampedShare :: (sds p (DateTime, a) (DateTime, a)) -> SDSLens p (DateTime, a) a | TC a && RWShared sds
My current solution is as follows:
stampedShare :: (sds () (DateTime, a) (DateTime, a)) -> SDSLens () (DateTime, a) a | TC a & RWShared sds stampedShare sds = mapReadWrite (fst , \a (_, dt)->Just ((dt, a), dt)) Nothing $ sds >*< (mapWrite (\_ _->Nothing) Nothing currentDateTime)
However, this get's a notification for every change in
currentDateTime and only works with a
I think the solution is to create a new parallel share combination that allows you to combine a share only for reading.
More will follow