summaryrefslogtreecommitdiff
path: root/snip/shebang.hs
blob: ce6c2c147e415a48c1e4c84ff525705efe16b990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env stack
-- stack --resolver lts-12.5 script
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Lazy.Char8 as L8
import           Network.HTTP.Simple

-- https://haskell-lang.org/tutorial/stack-script

main :: IO ()
main = do
    response <- httpLBS "http://httpbin.org/get"

    putStrLn $ "The status code was: " ++
               show (getResponseStatusCode response)
    print $ getResponseHeader "Content-Type" response
    L8.putStrLn $ getResponseBody response