~alcinnz/rhapsode

ref: 18bd686d755bf8288ce1f2a811e7a93cc8a35928 rhapsode/src/Main.hs -rw-r--r-- 517 bytes
18bd686d — Adrian Cochrane Fetch webpages from the Internet. 5 years ago
                                                                                
7523fb56 Adrian Cochrane
18bd686d Adrian Cochrane
7523fb56 Adrian Cochrane
18bd686d Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Main where

import System.Environment

import qualified Network.HTTP.Client as HTTP
import qualified Network.HTTP.Client.TLS as TLS
import qualified Data.ByteString.Lazy as Bytes


main :: IO ()
main = do
    url:_ <- getArgs
    -- TODO support more URI schemes, and do nonblocking networking. This could be it's own module.
    request <- HTTP.parseRequest url
    manager <- HTTP.newManager TLS.tlsManagerSettings
    response <- HTTP.httpLbs request manager
    Bytes.putStrLn $ HTTP.responseBody response