haskell - Breaking POST request into parts in Yesod -
i'm struggling split post response (multipart) apart, should used set contents of files sent yesod server database (after farther processing). current code:
import qualified data.bytestring.lazy lz import qualified data.bytestring.lazy.char8 lc ... processlines :: string -> [string] -> string processlines delim (l:rest) = case l of delim -> "" _ -> l ++ "\n" ++ processlines delim rest processfile :: [string] -> string processfile (delim:some:other:line:txt) = processlines delim txt postimpexr :: systemsid -> handler repplain postimpexr sysid = wr <- wairequest bss <- lift $ requestbody wr $$ consume allow file = lz.fromchunks bss return $ repplain $ tocontent $ processfile $ map lc.unpack $ lc.lines file
edit: managed prepare 1 problem, seems i'm on way understand handlers. what's problem types here?? there more elegant way done this?
if you're looking multipart support, that's built yesod, there's no need resort manual parsing. consider using filefield or lookupfile.
haskell post yesod
No comments:
Post a Comment