We could specify the time domain as `Maybe Time`, where
- `Nothing` is “before everything - distant past”, needed for “temporal default”,
- `Just t` are finite values of time
newtype Behaviour a = Behaviour (Maybe Time -> a)
It’s quite straightforward to verify that your Temporal and this Behaviour are isomorphic,
assuming that `Change`s are sorted by time, and there aren’t consecutive duplicates.
I find this “higher-order” formulation easier to reason about, as it’s `(->) Maybe Time`, for which we have
lot’s of machinery already defined (e.g. Monad).
So you could verify direct join implementation on `Temporal` by:
join_prop :: Temporal (Temporal Int) -> Property
join_prop temp = join temporal == fromBehaviour (join (toBehaviour temporal))
One might need to use weaker equality here though.
Am 03/31/2015 um 02:41 AM schrieb M Farkas-Dyck:On 30/03/2015 at 22:23:17 +0200, martin wrote:
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.
That neatly sums it up (and will make my code more concise). Thanks._______________________________________________Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe