Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow when processing telegram-api #167

Open
ndmitchell opened this issue May 27, 2016 · 6 comments
Open

Stack overflow when processing telegram-api #167

ndmitchell opened this issue May 27, 2016 · 6 comments

Comments

@ndmitchell
Copy link
Owner

Seemingly caused by the type signature:

type TelegramBotAPI = (TelegramToken :> ("getMe" :> Get '[JSON] GetMeResponse)) :<|> ((TelegramToken :> ("sendMessage" :> (ReqBody '[JSON] SendMessageRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("forwardMessage" :> (ReqBody '[JSON] ForwardMessageRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendPhoto" :> (MultipartFormDataReqBody (SendPhotoRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendPhoto" :> (ReqBody '[JSON] (SendPhotoRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendAudio" :> (MultipartFormDataReqBody (SendAudioRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendAudio" :> (ReqBody '[JSON] (SendAudioRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendDocument" :> (MultipartFormDataReqBody (SendDocumentRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendDocument" :> (ReqBody '[JSON] (SendDocumentRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendSticker" :> (MultipartFormDataReqBody (SendStickerRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendSticker" :> (ReqBody '[JSON] (SendStickerRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendVideo" :> (MultipartFormDataReqBody (SendVideoRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendVideo" :> (ReqBody '[JSON] (SendVideoRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendVoice" :> (MultipartFormDataReqBody (SendVoiceRequest FileUpload) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendVoice" :> (ReqBody '[JSON] (SendVoiceRequest Text) :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendLocation" :> (ReqBody '[JSON] SendLocationRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendVenue" :> (ReqBody '[JSON] SendVenueRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendContact" :> (ReqBody '[JSON] SendContactRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("sendChatAction" :> (ReqBody '[JSON] SendChatActionRequest :> Post '[JSON] ChatActionResponse))) :<|> ((TelegramToken :> ("getUpdates" :> (QueryParam "offset" Int :> (QueryParam "limit" Int :> (QueryParam "timeout" Int :> Get '[JSON] UpdatesResponse))))) :<|> ((TelegramToken :> ("getFile" :> (QueryParam "file_id" Text :> Get '[JSON] FileResponse))) :<|> ((TelegramToken :> ("getUserProfilePhotos" :> (QueryParam "user_id" Int :> (QueryParam "offset" Int :> (QueryParam "limit" Int :> Get '[JSON] UserProfilePhotosResponse))))) :<|> ((TelegramToken :> ("setWebhook" :> (QueryParam "url" Text :> Get '[JSON] SetWebhookResponse))) :<|> ((TelegramToken :> ("answerInlineQuery" :> (ReqBody '[JSON] AnswerInlineQueryRequest :> Post '[JSON] InlineQueryResponse))) :<|> ((TelegramToken :> ("answerCallbackQuery" :> (ReqBody '[JSON] AnswerCallbackQueryRequest :> Post '[JSON] CallbackQueryResponse))) :<|> ((TelegramToken :> ("kickChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> Post '[JSON] KickChatMemberResponse)))) :<|> ((TelegramToken :> ("leaveChat" :> (QueryParam "chat_id" Text :> Post '[JSON] LeaveChatResponse))) :<|> ((TelegramToken :> ("unbanChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> Post '[JSON] UnbanChatMemberResponse)))) :<|> ((TelegramToken :> ("getChat" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatResponse))) :<|> ((TelegramToken :> ("getChatAdministrators" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatAdministratorsResponse))) :<|> ((TelegramToken :> ("getChatMembersCount" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatMembersCountResponse))) :<|> ((TelegramToken :> ("getChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> Post '[JSON] GetChatMemberResponse)))) :<|> ((TelegramToken :> ("editMessageText" :> (ReqBody '[JSON] EditMessageTextRequest :> Post '[JSON] MessageResponse))) :<|> ((TelegramToken :> ("editMessageCaption" :> (ReqBody '[JSON] EditMessageCaptionRequest :> Post '[JSON] MessageResponse))) :<|> (TelegramToken :> ("editMessageReplyMarkup" :> (ReqBody '[JSON] EditMessageReplyMarkupRequest :> Post '[JSON] MessageResponse))))))))))))))))))))))))))))))))))))
@ndmitchell
Copy link
Owner Author

I tracked it down to haskell/pretty#32 (comment).

@ndmitchell
Copy link
Owner Author

ndmitchell commented Jun 3, 2016

I solved it in haskell/pretty#35, so we can get rid of this ticket when that is released.

@dterei
Copy link

dterei commented Jun 3, 2016

Just released 1.1.3.4 with the fix included.

ndmitchell added a commit that referenced this issue Jun 3, 2016
@ndmitchell
Copy link
Owner Author

So certainly the small test cases work, but actually doing an end-to-end test seems frustratingly difficult due to diamond dependencies and the preinstalled version of pretty. I reverted the reenable and will have to wait for library upgrades to percolate through the system

Reverted as 9b223d1.

@ndmitchell
Copy link
Owner Author

Seemingly pinchot also triggers the same stack overflow, but only on GHC 7.10 and below. I think the nice thing might be to disable these on the command line, so they don't cause problems in the test but are still documented.

@ndmitchell
Copy link
Owner Author

I've temporarily bumped the limit to 10K, and unexcluded the libraries that were problematic. Solution is a better command line interface to exclude them only during testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants