 waitForEvent :: Connection -> IO GenericEvent
 waitForEvent c = withConnection c $ \cPtr -> do
                  evPtr <- {#call wait_for_event#} cPtr
-                 liftM GenericEvent $ newForeignPtr finalizerFree evPtr
+                 GenericEvent <$> newForeignPtr finalizerFree evPtr
 
 instance HasResponseType GenericEvent where
     responseType = eventResponseType
 
 eventResponseType :: GenericEvent -> IO Int
 eventResponseType ev = withGenericEvent ev $ \evPtr ->
-                       liftM fromIntegral $ {#get generic_event_t->response_type#} evPtr
+                       fromIntegral <$> {#get generic_event_t->response_type#} evPtr
 
 -- | The conversion is not checked.             
 unsafeToBigEvent :: GenericEvent -> GenericBigEvent

-- location as the 'GenericReply'
unsafeReplyData :: GenericReply -> IO S.ByteString
unsafeReplyData rep@(GenericReply repFPtr) = do
  len <- fromIntegral `liftM` replyLength rep
  return $ S.fromForeignPtr (castForeignPtr repFPtr) 0 (4*len)

-- Sending requests

      withLazyByteString bytes $ \vec vecNum ->
      withIOVec vec $ \vecPtr -> do
      {#set protocol_request_t->count#} rPtr (fromIntegral vecNum)
      Cookie . fromIntegral <$> {#call send_request#} cPtr (fromIntegral flags) (castPtr vecPtr) rPtr

-- | Return 'Nothing' on failure, or the last request id on success.
-- This must be called before calling 'writev', as it indicates that you would
