[Haskell-cafe] Semantics of temporal data
M Farkas-Dyck
strake888 at gmail.com
Tue Mar 31 00:41:52 UTC 2015
On 30/03/2015 at 22:23:17 +0200, martin wrote:
> Hello all,
>
> I wrote a Temporal datatype
>
> data Temporal a = Temporal {
> td :: a, -- "temporal default"
> tc :: [Change a] -- "temporal changes"
> } deriving (Eq, Show)
>
> data Change a = Chg {
> ct :: Time, -- "change time"
> cv :: a -- "change value"
> } deriving (Eq,Show)
>
> I got into semantic trouble when trying to write "join" for Temporal (Temporal a).
> It appears to me that the defaults of the inner Temporal lose most of their meaning. The effective default is the change
> value of the last accepted change from the previous (t0) iteration.
> Does this make some sense? Please feel free to comment.
Yes, as the default value is essentially a change at the lower bound of time, 0 or -∞ or whenever it is, so if we join
Temporal x [Change t1 (Temporal y _)]
the change to y in the inner Temporal would happen at earliest possible time, so assuming t1 is later than this y ought to be ignored, I think.
More information about the Haskell-Cafe
mailing list