diff options
| author | Miguel <m.i@gmx.at> | 2019-03-17 19:35:51 +0100 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-03-17 19:35:51 +0100 |
| commit | 0268d3c0ca48bd9cf9df67b469218fc0e47ebce7 (patch) | |
| tree | c35bbf7a7527e307b205ccf55ff1bf7d9472e5ac /snip | |
| parent | 3cc94dfe978489771b573509cb0785001a7c50d4 (diff) | |
shebang snippet
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 |
