From f8966a11ed8208d978e7fc7bc556d4e4f4752a6b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 11 May 2018 09:05:27 -0400 Subject: [PATCH] Define unLatest as a function rather than a field selector. --- src/Data/Abstract/Address.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Data/Abstract/Address.hs b/src/Data/Abstract/Address.hs index 26d0f83d2..46a2d580b 100644 --- a/src/Data/Abstract/Address.hs +++ b/src/Data/Abstract/Address.hs @@ -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