Commit f2b19cfa authored by Mart Lubbers's avatar Mart Lubbers

Make the type of timespecStampedShare more general and export dateTimeStampedShare

parent 2da7d59b
Pipeline #31807 passed with stage
in 6 minutes and 53 seconds
......@@ -3,6 +3,7 @@ definition module iTasks.Extensions.DateTime
* This module provides types for working with dates and times
*/
import iTasks.WF.Definition
import iTasks.SDS.Definition
from Data.Error import :: MaybeError, :: MaybeErrorString
from Text.GenPrint import generic gPrint, :: PrintState, class PrintOutput
......@@ -150,3 +151,10 @@ waitForDateTime :: !DateTime -> Task DateTime
waitForTimer :: !Int -> Task DateTime
/**
* Automatically stamp the share data with the datetime of writing
*
* @param the sds to automatically stamp the data for
* @return the resulting sds
*/
dateTimeStampedShare :: !(sds p b (DateTime,c)) -> SDSLens p b c | gText{|*|}, TC p & TC b & TC c & RWShared sds
......@@ -239,7 +239,7 @@ waitForTimer interval =
timestampToLocalDateTime (Timestamp (now + interval)) >>- \endTime ->
waitForDateTime endTime
dateTimeStampedShare :: (sds p (DateTime,a) (DateTime,a)) -> SDSLens p (DateTime, a) a | gText{|*|} p & TC p & TC a & RWShared sds
dateTimeStampedShare :: !(sds p b (DateTime,c)) -> SDSLens p b c | gText{|*|}, TC p & TC b & TC c & RWShared sds
dateTimeStampedShare sds
= sdsTranslate "dateTimeStampedShare" (\p->(p, ()))
(sdsStamp sds currentDateTime (\x y->(x, y)))
......@@ -57,7 +57,7 @@ sdsStamp :: !(sds1 p1 r1 w1) !(sds2 p2 r2 w2) (r2 w -> w1) -> SDSLens (p1, p2) r
* @param the sds to automatically stamp the data for
* @return the resulting sds
*/
timespecStampedShare :: (sds p (Timespec,a) (Timespec,a)) -> SDSLens p (Timespec, a) a | gText{|*|} p & TC p & TC a & RWShared sds
timespecStampedShare :: !(sds p b (Timespec,c)) -> SDSLens p b c | gText{|*|}, TC p & TC b & TC c & RWShared sds
// Treat symmetric sources with optional values as if they always have a value.
// You can provide a default value, if you don't it will trigger a read error
......
......@@ -61,7 +61,7 @@ sdsStamp source helper writefun = sdsLens "*<" id
source
(mapWrite (\_ _->Nothing) Nothing $ SDSNoNotify helper)
timespecStampedShare :: (sds p (Timespec,a) (Timespec,a)) -> SDSLens p (Timespec, a) a | gText{|*|} p & TC p & TC a & RWShared sds
timespecStampedShare :: !(sds p b (Timespec,c)) -> SDSLens p b c | gText{|*|}, TC p & TC b & TC c & RWShared sds
timespecStampedShare sds
= sdsTranslate "timespecStampedShare" (\p->(p, ()))
$ sdsStamp sds currentTimespec \x y->(x, y)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment