sendRequestImpl :: ForeignPtr SessionImpl
                -> Request
                -> Maybe CorrelationId
                -> Maybe (ForeignPtr IdentityImpl)
                -> IO ()
sendRequestImpl s req cid idPtr = do
    rc <- withForeignPtr s $ \p ->
      withForeignPtr (getImpl req) $ \r ->
        withMaybeCid cid $ \cidPtr ->
          case idPtr of
            Just idenPtr ->
              withForeignPtr idenPtr $ \iden ->
                blpapi_Session_sendRequest p r cidPtr iden nullPtr nullPtr 0
            Nothing ->
                blpapi_Session_sendRequest p r cidPtr nullPtr nullPtr nullPtr 0
    failIfBadErrorCode rc
sendRequestImpl :: ForeignPtr SessionImpl
                -> Request
                -> Maybe CorrelationId
                -> Maybe (ForeignPtr IdentityImpl)
                -> IO ()
sendRequestImpl s req cid idPtr = do
    rc <- withForeignPtr s $ \p ->
      withForeignPtr (getImpl req) $ \r ->
        withMaybeCid cid $ \cidPtr ->
          case idPtr of
            Just idenPtr ->
              withForeignPtr idenPtr $ \iden ->
                blpapi_Session_sendRequest p r cidPtr iden nullPtr nullPtr 0
            Nothing ->
                blpapi_Session_sendRequest p r cidPtr nullPtr nullPtr nullPtr 0
    failIfBadErrorCode rc
sendRequestImpl s req cid idPtr = do
    rc <- withForeignPtr s $ \p ->
      withForeignPtr (getImpl req) $ \r ->
        withMaybeCid cid $ \cidPtr ->
          case idPtr of
            Just idenPtr ->
              withForeignPtr idenPtr $ \iden ->
                blpapi_Session_sendRequest p r cidPtr iden nullPtr nullPtr 0
            Nothing ->
                blpapi_Session_sendRequest p r cidPtr nullPtr nullPtr nullPtr 0
    failIfBadErrorCode rc