import Yesod
import Data.Text
data App = App
instance Yesod App
mkYesod "App" [parseRoutes|
/ Home GET
|]
getHome :: String -> Handler Value
getHome = object ["name" .= ("Adam"::Text)]
main = warpDebug 2012 App
throws error as,
Couldn't match expected type ‘String -> Handler Value’
with actual type ‘Value’
Possible cause: ‘object’ is applied to too many arguments
In the expression: object ["name" .= ("Adam" :: Text)]
In an equation for ‘getHome’:
getHome = object ["name" .= ("Adam" :: Text)]
object
is not in scope in prelude. Which package/module defines this? Why doesn't it take the key-value pair in the above case?
object
is not in scope in prelude. Which package/module defines this?
Why doesn't it take the key-value pair in the above case?
It takes the key value pair just fine. The error message is telling you that object
gives you a Value
, but you declared getHome
to be of type String -> Handler Value
, not Value
.
The "possible cause" seems to just be misleading in this case.