diff options
Diffstat (limited to 'snip')
| -rwxr-xr-x | snip/shebang.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/snip/shebang.hs b/snip/shebang.hs new file mode 100755 index 0000000..ce6c2c1 --- /dev/null +++ b/snip/shebang.hs @@ -0,0 +1,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 |
