Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Created February 7, 2019 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-martin/0dead7d6e9c57ad60d1a6ed5b956cb91 to your computer and use it in GitHub Desktop.
Save chris-martin/0dead7d6e9c57ad60d1a6ed5b956cb91 to your computer and use it in GitHub Desktop.
import Pipes
import Pipes.HTTP
import qualified Pipes.Prelude as P
import qualified Pipes.ByteString as PB
import qualified Data.ByteString as BS
url = "https://typeclasses.com"
fetch url action =
do
req <- parseRequest url
m <- newManager tlsManagerSettings
withHTTP req m action
main =
fetch url $ \response ->
P.sum (responseBody response >-> P.map BS.length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment