M rhapsode.cabal => rhapsode.cabal +1 -1
@@ 60,7 60,7 @@ executable rhapsode
-- other-extensions:
-- Other library packages from which modules are imported.
- build-depends: base >=4.9 && <4.10
+ build-depends: base >=4.9 && <4.10, http-client, http-client-tls, bytestring
-- Directories containing source files.
hs-source-dirs: src
M src/Main.hs => src/Main.hs +14 -1
@@ 1,4 1,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 = putStrLn "Hello, Haskell!"
+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