在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):intolerable/reddit开源软件地址(OpenSource Url):https://github.com/intolerable/reddit开源编程语言(OpenSource Language):Haskell 100.0%开源软件介绍(OpenSource Introduction):reddit for haskellA Haskell library for interacting with the Reddit API. A couple of examplesLet's get all the posts from the frontpage of Reddit and write a summary of each of them to the console: {-# LANGUAGE OverloadedStrings #-}
import Reddit
import Reddit.Types.Post
import Control.Monad
import Control.Monad.IO.Class
import Data.Monoid
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
main = runRedditAnon $ do
Listing _ _ posts <- getPosts
forM_ posts $ \post -> do
liftIO $ Text.putStrLn $
"[" <> tshow (score post) <> "] " <>
title post <> " (" <> tshow (subreddit post) <> ")"
tshow = Text.pack . show Let's check to see which of a group of users has the highest link karma: {-# LANGUAGE OverloadedStrings #-}
import Reddit
import Reddit.Types.User
import Data.List
import Data.Ord
usersToCheck = ["nikita-volkov", "simonmar", "bos", "roche"]
main = runRedditAnon $ do
infos <- mapM (getUserInfo . Username) usersToCheck
return $ maximumBy (comparing linkKarma) infos TestingPure tests
This suite will only run test that don't require doing any IO. Helpful because it runs quickly and isn't subject to any network problems. Anonymous tests
There's also a suite of tests that can be run anonymously without having to set up a user account and an empty subreddit. Full IO tests
The
Your app client and secret can be found in your reddit preferences |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论