Commits

Bryan O'Sullivan committed 65b48a0

Add a Resolvable instance for Maybe

  • Participants
  • Parent commits 62bbb0d

Comments (0)

Files changed (1)

File src/Network/Riak/Resolvable/Internal.hs

     resolve = mappend
     {-# INLINE resolve #-}
 
+instance (Resolvable a) => Resolvable (Maybe a) where
+    resolve (Just a)   (Just b) = Just (resolve a b)
+    resolve a@(Just _) _        = a
+    resolve _          b        = b
+    {-# INLINE resolve #-}
+
 get :: (Resolvable a) =>
        (Connection -> Bucket -> Key -> R -> IO (Maybe ([a], VClock)))
        -> (Connection -> Bucket -> Key -> R -> IO (Maybe (a, VClock)))