Last active
December 31, 2015 10:49
-
-
Save MarkJr94/7975626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Network.HTTP.Conduit | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Lazy as L | |
import qualified Data.ByteString.UTF8 as BU | |
import qualified Data.ByteString.Lazy.UTF8 as LU | |
import qualified Data.Text as T | |
import Data.Conduit | |
import qualified Data.Conduit.List as CL | |
import qualified Data.Conduit.Binary as CB | |
import System.IO | |
sink = undefined | |
main = do | |
request <- parseUrl "http://www.reddit.com/user/urdnot_rekt/comments.json" | |
let req = request { queryString = BU.fromString "limit=100" } | |
withManager $ \manager -> do | |
response <- http req manager | |
let body = responseBody response | |
body $$+- CB.sinkHandle stdout | |
-- body $$+- sink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SPOILERS
Then try to make a data type to represent the API, such as
Comment
, then change theJ.Value
to your data type.http://hackage.haskell.org/package/aeson-0.6.2.1/docs/Data-Aeson.html