Created
November 3, 2013 06:44
-
-
Save AshyIsMe/7287473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aarons-MacBook-Air:haskell-scraper aaron$ ghc main.hs | |
Scraper.hs:4:8: | |
Could not find module `Network.HTTP' | |
Use -v to see a list of the files searched for. | |
Aarons-MacBook-Air:haskell-scraper aaron$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment (getArgs) | |
import Scraper | |
main = do | |
args <- getArgs | |
results <- mapM (\x -> fetch $ baseurl ++ x) args | |
--putStrLn "Arguments are: " | |
mapM_ putStrLn args | |
--putStrLn "Results are: " | |
mapM_ putStrLn results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Scraper | |
where | |
import Network.HTTP | |
import Control.Applicative | |
baseurl = "http://ichart.finance.yahoo.com/table.csv?d=9&e=25&f=2013&g=d&a=8&b=8&c=2010&ignore=.csv&s=" --MAD.AX | |
-- fetch via GET | |
fetch :: String -> IO String | |
fetch url = do | |
response <- simpleHTTP (getRequest url) | |
body <- getResponseBody response | |
return body | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with ghc -v: