Yesod のハンドラーから最も単純な JSON 応答を書き込もうとしていますが、本当にばかげたエラーが (明らかに) あります。私のハンドラコードはこれです:
-- HelloYesod/Handler/Echo.hs
module Handler.Echo where
import Data.Aeson (object, (.=))
import qualified Data.Aeson as J
import Data.Text (pack)
import Import
import Yesod.Core.Json (returnJson)
getEchoR :: String -> Handler RepJson
getEchoR theText = do
let json = object $ ["data" .= "val"]
return json
エラーはこれです:
Handler/Echo.hs:12:10:
Couldn't match expected type `RepJson' with actual type `Value'
In the first argument of `return', namely `json'
In a stmt of a 'do' block: return json
In the expression:
do { let json = object $ ...;
return json }
Build failure, pausing...