mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Define unLatest as a function rather than a field selector.
This commit is contained in:
parent
46295fed52
commit
f8966a11ed
@ -55,9 +55,12 @@ instance Location (Located location) where
|
|||||||
-- | A cell holding a single value. Writes will replace any prior value.
|
-- | A cell holding a single value. Writes will replace any prior value.
|
||||||
-- This is isomorphic to 'Last' from Data.Monoid, but is more convenient
|
-- This is isomorphic to 'Last' from Data.Monoid, but is more convenient
|
||||||
-- because it has a 'Reducer' instance.
|
-- 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)
|
deriving (Eq, Foldable, Functor, Generic1, Lower, Ord, Show, Traversable)
|
||||||
|
|
||||||
|
unLatest :: Latest value -> Maybe value
|
||||||
|
unLatest (Latest value) = value
|
||||||
|
|
||||||
instance Semigroup (Latest value) where
|
instance Semigroup (Latest value) where
|
||||||
a <> Latest Nothing = a
|
a <> Latest Nothing = a
|
||||||
_ <> b = b
|
_ <> b = b
|
||||||
|
Loading…
Reference in New Issue
Block a user