I'm just starting to do Yesod + Haskell stuff. Is jsonToRepJson broken or something else?
I made this code below, but always get the error in the jsonToRepJson part. Doesn't it seem to get the expected type?
Any help would be great! Thanks: 3
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} import Yesod import Data.Text data APP = APP instance Yesod APP mkYesod "APP" [parseRoutes| / TestR GET |] getTestR :: Handler RepJson getTestR = jsonToRepJson $ object ["test".= ("test"::Text)] main::IO() main = warpDebug 3001 APP
this is what i get when i use runhaskell
api.hs:18:12: Couldn't match expected type `RepJson' with actual type `Value' Expected type: Handler RepJson Actual type: HandlerT APP IO Value In the expression: jsonToRepJson $ object ["test" .= ("test" :: Text)] In an equation for `getTestR': getTestR = jsonToRepJson $ object ["test" .= ("test" :: Text)]
source share