userStreamIter :: Token -> (Status -> IO a) -> IO (Result ())
userStreamIter tok f = callStreamAPI handler GET tok "user" []
  where
    handler (W.Status sc _) hs = do
        splitStreamE =$ do
            -- drop initial stream, friends list
            EL.head
            E.continue go
        return (Response sc hs "")
    go (E.Chunks css) = do
        forM_ css $ \cs -> case decode cs >>= decodeStatus of
            Ok st   -> liftIO (f st) >> return ()
            Error e -> debug e
        E.continue go
    go E.EOF        = E.yield () E.EOF


-- | call twitter API
-- callStreamAPI handler GET tok "user" []
userStreamIter :: Token -> (Status -> IO a) -> IO (Result ())
userStreamIter tok f = callStreamAPI handler GET tok "user" []
  where
    handler (W.Status sc _) hs = do
        splitStreamE =$ do
            -- drop initial stream, friends list
            EL.head
            E.continue go
        return (Response sc hs "")
    go (E.Chunks css) = do
        forM_ css $ \cs -> case decode cs >>= decodeStatus of
            Ok st   -> liftIO (f st) >> return ()
            Error e -> debug e
        E.continue go
    go E.EOF        = E.yield () E.EOF


-- | call twitter API
-- callStreamAPI handler GET tok "user" []
userStreamIter tok f = callStreamAPI handler GET tok "user" []
  where
    handler (W.Status sc _) hs = do
        splitStreamE =$ do
            -- drop initial stream, friends list
            EL.head
            E.continue go
        return (Response sc hs "")
    go (E.Chunks css) = do
        forM_ css $ \cs -> case decode cs >>= decodeStatus of
            Ok st   -> liftIO (f st) >> return ()
            Error e -> debug e
        E.continue go
    go E.EOF        = E.yield () E.EOF


-- | call twitter API
-- callStreamAPI handler GET tok "user" []