I have a function that takes in a Reddit comment and spits out a reply. I want this function to map over every new comment posted on Reddit.
How should I get the comments from reddit? It seems a bit wasteful to just pull in the 100 most recent comments very often so none are missed. A way to get all comments newer than a specific comment be very good.
Ideally the comments would just be a lazy list so I just could do
f :: Comment -> IO ()
getComments :: IO [Comment]
main :: IO ()
main = do
comments <- getComments
traverse_ f comments
Or I could write an interact function:
f :: Comment -> Comment
interact :: (Comment -> Comment) -> IO ()
main :: IO ()
main = interact f