나는 간단한 yesod 템플릿을 기반으로하는 프로젝트 작업을하고 있습니다. 나는 기능 프로그래밍, haskell 및 Yesodd를 처음 사용하므로 Yesod 경험을 가진 사람이라면 누구에게나 명백한 것이 될 것입니다. 현재이 library을 사용하여 github API 호출을 만들려고합니다. 유형 문제가 발생하고 있으며 문제 해결 방법을 시작하는 방법조차 모릅니다.Yesod : Haskell 용 Github API v3 라이브러리 사용
내 처리기 here을 찾을 수 있습니다.
Handler/Home.hs:43:19:
Couldn't match expected type ‘HandlerT
App IO (Either a0 GitHub.User)’
with actual type ‘GitHub.Request k0 GitHub.User’
In a stmt of a 'do' block:
possibleUser <- GitHub.userInfoForR "mike-burns"
In the expression:
do { maid <- maybeAuthId;
possibleUser <- GitHub.userInfoForR "mike-burns";
result <- either (("Error: " <>) . tshow) formatUser possibleUser;
defaultLayout
(do { (asWidgetT GHC.Base.. toWidget)
((blaze-markup-0.7.1.1:Text.Blaze.Internal.preEscapedText
GHC.Base.. Data.Text.pack)
"<p>Your current auth ID: ");
(asWidgetT GHC.Base.. toWidget) (toHtml (show maid));
(asWidgetT GHC.Base.. toWidget)
((blaze-markup-0.7.1.1:Text.Blaze.Internal.preEscapedText
GHC.Base.. Data.Text.pack)
"</p>\n");
.... }) }
Handler/Home.hs:44:38:
Couldn't match type ‘Text’ with ‘HandlerT App IO a1’
Expected type: a0 -> HandlerT App IO a1
Actual type: a0 -> Text
In the second argument of ‘(.)’, namely ‘tshow’
In the first argument of ‘either’, namely
‘(("Error: " <>) . tshow)’
Handler/Home.hs:44:45:
Couldn't match type ‘Text’ with ‘HandlerT App IO a1’
Expected type: GitHub.User -> HandlerT App IO a1
Actual type: GitHub.User -> Text
In the second argument of ‘either’, namely ‘formatUser’
In a stmt of a 'do' block:
result <- either (("Error: " <>) . tshow) formatUser possibleUser
- GitHub.userInfoForR "마이크 - 화상"'쓰기'possibleUser = GitHub.userInfoForR "마이크 - 화상"' – arrowd
안녕 arrowd을 할 수 있습니다. 그것은 실제로 "possibleUser"줄과 관련된 오류를 제거하지만 다음 "결과 줄에서 그 변수를 사용하면 다음 오류가 발생합니다 (아마도 'in'을 사용하여 구조화해야합니까?) : Handler/Home.hs : 49 : 59 :' '예상 유형과 일치 할 수 없음 'A01 GitHub.User''실제 유형'GitHub.Request k0 GitHub.User'' ' 'either'의 세 번째 인수 인 ' possibleUser'' '표현식 :' '(("오류 :"<>). tshow) formatUser possibleUser' – StarStuffSteve