
Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong. postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."] jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter')) --Zach

maybe you want:
jsonToRepJson $ jsonMap [("text", text'),( "charecter", charecter')]
check that turned on OverloadedStrings lang extension
2011/3/30 Zachary Kessin
Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong.
postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."]
jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter'))
--Zach
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- Best regards, Cheshkov Anton Phone: +7 909 005 18 82 Skype: cheshkov_anton

Yes it is on.
--Zach
On Tue, Mar 29, 2011 at 9:06 PM, Anton Cheshkov
maybe you want: jsonToRepJson $ jsonMap [("text", text'),( "charecter", charecter')]
check that turned on OverloadedStrings lang extension
2011/3/30 Zachary Kessin
Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong.
postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."]
jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter'))
--Zach
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- Best regards, Cheshkov Anton Phone: +7 909 005 18 82 Skype: cheshkov_anton

Are you getting a compile-time error, or is the result at runtime not
what you expected? More details will be helpful here.
Michael
On Tue, Mar 29, 2011 at 8:58 PM, Zachary Kessin
Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong. postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."]
jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter'))
--Zach _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

Compile time error, plus I'm pretty sure the code
is not actually doing what I want it to.
Like I said, I want a post method that will add a row to the database, and a
get that
will retrieve a list of the rows (as a JSON).
--Zach
On Tue, Mar 29, 2011 at 9:29 PM, Michael Snoyman
Are you getting a compile-time error, or is the result at runtime not what you expected? More details will be helpful here.
Michael
On Tue, Mar 29, 2011 at 8:58 PM, Zachary Kessin
wrote: Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong. postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."]
jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter'))
--Zach _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

To be effective in haskell we have to learn how to interpret compiler error
messages. For others to be effective at helping you with your problems, they
need to see your compiler error messages.
On Tue, Mar 29, 2011 at 12:40 PM, Zachary Kessin
Compile time error, plus I'm pretty sure the code is not actually doing what I want it to.
Like I said, I want a post method that will add a row to the database, and a get that will retrieve a list of the rows (as a JSON).
--Zach
On Tue, Mar 29, 2011 at 9:29 PM, Michael Snoyman
wrote: Are you getting a compile-time error, or is the result at runtime not what you expected? More details will be helpful here.
Michael
On Tue, Mar 29, 2011 at 8:58 PM, Zachary Kessin
wrote: Ok, I'm trying to setup a handler to take data from a HTTP post, and store it into a database, This is what I came up with, but its not right. Can someone tell me what I am doing wrong. postPostMessageR :: Handler RepJson postPostMessageR = do liftIO $ putStrLn "POST" CharecterPost clients _ <- getYesod (text, charecter) <- do text <- lookupPostParam "text" charecter <- lookupPostParam "charecter" case (text, charecter) of (Just text', Just charecter') -> return (text', charecter') _ -> invalidArgs ["text not provided."]
jsonToRepJson $ jsonMap (("text", text'),( "charecter", charecter'))
--Zach _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (4)
-
Anton Cheshkov
-
Greg Weber
-
Michael Snoyman
-
Zachary Kessin