OK, no need to resend.

On Thu, Apr 10, 2014 at 1:12 PM, Klaus Aehlig <[email protected]> wrote:

> On Thu, Apr 10, 2014 at 12:57:50PM +0200, Petr Pudlák wrote:
> > On Wed, Apr 9, 2014 at 9:06 PM, Klaus Aehlig <[email protected]> wrote:
> >
> > > The internal representation of the lock waiting structure contains
> > > some arbitrariness---pending requests are arbitrarily keyed by one
> > > of the lock owners that blocks them. Therefore, LockWaiting is not
> > > an instance of Eq. To allow some meaningful form of comparison
> > > nevertheless (in particular for testing), provide some representation
> > > of LockWaiting where equality on the representation is observable
> > > equivalence.
> > >
> > > Signed-off-by: Klaus Aehlig <[email protected]>
> > > ---
> > >  src/Ganeti/Locking/Waiting.hs | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > >
> > > diff --git a/src/Ganeti/Locking/Waiting.hs
> b/src/Ganeti/Locking/Waiting.hs
> > > index 2f99fe8..d0f60a8 100644
> > > --- a/src/Ganeti/Locking/Waiting.hs
> > > +++ b/src/Ganeti/Locking/Waiting.hs
> > > @@ -33,8 +33,10 @@ module Ganeti.Locking.Waiting
> > >   , removePendingRequest
> > >   , releaseResources
> > >   , getPendingRequests
> > > + , extRepr
> > >   ) where
> > >
> > > +import Control.Arrow ((&&&))
> > >  import qualified Data.Map as M
> > >  import Data.Maybe (fromMaybe)
> > >  import qualified Data.Set as S
> > > @@ -99,6 +101,14 @@ getPendingRequests :: (Ord a, Ord b, Ord c)
> > >                     => LockWaiting a b c -> S.Set (c, b,
> [L.LockRequest a])
> > >  getPendingRequests = S.unions . M.elems . lwPending
> > >
> > > +-- | Get a representation, comparable by (==), that captures the
> > > extensional
> > > +-- behaviour. In other words, @uncurry (==) . (extRepr &&& extRepr)@
> is a
> >
> > +-- bisumlation.
> > >
> >
> > [...] Or perhaps `on (==) extRepr`?
>
> Thanks for spotting this. I meant "(==) `on` extRepr". I will change the
> comment accordingly.
>
> > LGTM
>
> Thanks.
>
> --
> Klaus Aehlig
> Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores
>

Reply via email to