Guest User

Untitled

a guest
Mar 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. suggestedPostsFor userId = do
  2. friendIds <- friendsOf userId -- Get the friends of the current user
  3. topics <- favoriteTopicsOf userId -- Get the favorite topics of the current user
  4. friendsPosts <- forM friendIds $ \friendId -> do -- For each friend
  5. posts <- lastPostsOf friendId -- * Get their last posts
  6. return (filter (isAbout topics) posts) -- * Keep those whose topic is relevant
  7. return (mostLiked 3 friendsPosts) -- Rank them to keep only the bests
Add Comment
Please, Sign In to add comment