Skip to content

@esmooov /parsecon.hs secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
repParse !input (!st,Nothing) = case result of
(Partial parser) -> (st,Just parser)
(Done !res "") -> (res:st,Just (\input -> Done RDBNull input))
(Done !res !leftover) -> repParse leftover (res:st,Nothing)
where
!result = runGetPartial getObjInc input
repParse !input (!st,Just parser) = case result of
(Partial parser) -> (st,Just parser)
(Done !res "") -> (res:st,Just (\input -> Done RDBNull input))
(Done !res !leftover) -> repParse leftover (res:st,Nothing)
where
!result = parser input
printRDB :: ResourceIO m => Sink B8.ByteString m ()
printRDB =
sinkState Nothing
pushRDB
(\state -> return ())
pushRDB Nothing !input = do liftIO $ mapM_ (\x -> if x == RDBNull then return () else print x) st
return $ StateProcessing p
where
(Done r l) = runGetPartial (getBytes 9) input
(!st,!p) = repParse l ([],Nothing)
pushRDB (Just parser) !input = do liftIO $ mapM_ (\x -> if x == RDBNull then return () else print x) st
return $ StateProcessing p
where
(!st,!p) = repParse input ([],Just parser)
main = do
runResourceT $ C.sourceFile "./dump.rdb" $$ printRDB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.