Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Mergeful.Timed
Description
Dealing with server times.
If you are importing this module, you are probably doing something wrong.
Synopsis
- newtype ServerTime = ServerTime {}
- initialServerTime :: ServerTime
- incrementServerTime :: ServerTime -> ServerTime
- data Timed a = Timed {
- timedValue :: !a
- timedTime :: !ServerTime
- timedObjectCodec :: HasCodec a => JSONObjectCodec (Timed a)
Documentation
newtype ServerTime Source #
A "time", as "measured" by the server.
This is closer to a version number than an actual timestamp, but that distinction should not matter for your usage of this library.
In any case, a client should not be changing this value.
We use a Word64
instead of a natural.
This will go wrong after 2^64 versions, but since that
will not happen in practice, we will not worry about it.
You would have to sync millions of modifications every second
until long after the sun consumes the earth for this to be a problem.
Constructors
ServerTime | |
Fields |
Instances
initialServerTime :: ServerTime Source #
A server time to start with.
incrementServerTime :: ServerTime -> ServerTime Source #
Increment a server time.
A value along with a server time.
Constructors
Timed | |
Fields
|
Instances
Eq a => Eq (Timed a) Source # | |
Show a => Show (Timed a) Source # | |
Generic (Timed a) Source # | |
HasCodec a => ToJSON (Timed a) Source # | |
Defined in Data.Mergeful.Timed | |
HasCodec a => FromJSON (Timed a) Source # | |
HasCodec a => HasCodec (Timed a) Source # | |
Defined in Data.Mergeful.Timed | |
NFData a => NFData (Timed a) Source # | |
Defined in Data.Mergeful.Timed | |
Validity a => Validity (Timed a) Source # | |
Defined in Data.Mergeful.Timed Methods validate :: Timed a -> Validation # | |
type Rep (Timed a) Source # | |
Defined in Data.Mergeful.Timed type Rep (Timed a) = D1 ('MetaData "Timed" "Data.Mergeful.Timed" "mergeful-0.3.0.0-IufP8wiUmUb8vtwEhWnzS0" 'False) (C1 ('MetaCons "Timed" 'PrefixI 'True) (S1 ('MetaSel ('Just "timedValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "timedTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ServerTime))) |
timedObjectCodec :: HasCodec a => JSONObjectCodec (Timed a) Source #