"//*.matchpages" %> \out -> do
let year = takeBaseName out
let html = year <.> "matches.html"
need [html]
() <- cmd "mkdir" out
Stdout stdout <- cmd Shell "grep" "Match stats" html "|" "grep -oE" "'[[:digit:]]+.html'"
Now I need to run this function for each line of stdout, something like:
map (\x -> cmd ("curl http://afltables.com/afl/stats/games/"++year++"/"++x) "-o" (out </> xl)) (lines stdout)
I get type mismatches though (it needs an Action ()) which I can't figure out because I'm still new to Haskell.
Can you suggest a solution?
Thanks for any help,
Ryan
On May 11, 2016 10:09 AM, <ryan....@gmail.com> wrote:
>
> I'm trying to download a list of webpages to a directory, where the directory is my target
> to be built:
>
> "//*.matchpages" %> \out -> do
> let year = takeBaseName out
> let html = year <.> "matches.html"
> need [html]
> () <- cmd "mkdir" out
> Stdout stdout <- cmd Shell "grep" "Match stats" html "|" "grep -oE" "'[[:digit:]]+.html'"
>
> Now I need to run this function for each line of stdout, something like:
>
> map (\x -> cmd ("curl http://afltables.com/afl/stats/games/"++year++"/"++x) "-o" (out </> xl)) (lines stdout)
>
What if you change the `map` to `mapM_`?
> I get type mismatches though (it needs an Action ()) which I can't figure out because I'm still new to Haskell.
> Can you suggest a solution?
>
> Thanks for any help,
> Ryan
--
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong.
http://kirbyfan64.github.io/