Repro
Save to ./gh-repro.hs
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import qualified Data.ByteString.Char8 as C8
import GitHub.Endpoints.Issues.Comments
import System.Environment (getEnv)
main :: IO ()
main = do
let owner = "restyled-io"
repo = "restyled.io"
issue = IssueNumber 155
auth <- OAuth . C8.pack <$> getEnv "GITHUB_ACCESS_TOKEN"
Right comment <- createComment auth owner repo issue "Test comment"
result <- deleteComment auth owner repo $ commentId comment
print result
GITHUB_ACCESS_TOKEN=<something with repo scopes> \
stack runghc --resolver lts-13.23 --package github-0.21 ./gh-repro.hs
Expected
The comment is removed and the API response successfully returned according to deleteCommentR's type as:
Actual
The comment is removed, but the result is an error in Left:
Left (ParseError "Error in $: not enough input")
Hypothesis
The commonly-used Request synonym fixes to MtJSON, but an endpoint such as this returns 204 No Content, so trying to parse no content to () fails. I'm guessing such an endpoint function needs to use MtUnit.
Repro
Save to
./gh-repro.hs{-# LANGUAGE OverloadedStrings #-} module Main (main) where import qualified Data.ByteString.Char8 as C8 import GitHub.Endpoints.Issues.Comments import System.Environment (getEnv) main :: IO () main = do let owner = "restyled-io" repo = "restyled.io" issue = IssueNumber 155 auth <- OAuth . C8.pack <$> getEnv "GITHUB_ACCESS_TOKEN" Right comment <- createComment auth owner repo issue "Test comment" result <- deleteComment auth owner repo $ commentId comment print resultExpected
The comment is removed and the API response successfully returned according to
deleteCommentR's type as:Actual
The comment is removed, but the result is an error in
Left:Left (ParseError "Error in $: not enough input")Hypothesis
The commonly-used
Requestsynonym fixes toMtJSON, but an endpoint such as this returns204 No Content, so trying to parse no content to()fails. I'm guessing such an endpoint function needs to useMtUnit.