1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Define unLatest as a function rather than a field selector.

This commit is contained in:
Rob Rix 2018-05-11 09:05:27 -04:00
parent 46295fed52
commit f8966a11ed

View File

@ -55,9 +55,12 @@ instance Location (Located location) where
-- | A cell holding a single value. Writes will replace any prior value.
-- This is isomorphic to 'Last' from Data.Monoid, but is more convenient
-- because it has a 'Reducer' instance.
newtype Latest value = Latest { unLatest :: Maybe value }
newtype Latest value = Latest (Maybe value)
deriving (Eq, Foldable, Functor, Generic1, Lower, Ord, Show, Traversable)
unLatest :: Latest value -> Maybe value
unLatest (Latest value) = value
instance Semigroup (Latest value) where
a <> Latest Nothing = a
_ <> b = b