In this recipe, we will use a package blaze-from-html to reverse engineer an existing HTML page, to create Haskell code that uses blaze-html.
Using blaze to reverse engineer an HTML page
How to do it...
- Install blaze-from-html using stack. Here we use the resolver lts-9.1. Feel free to use the latest or your favorite resolver:
stack --resolver lts-9.1 install blaze-from-html
- Check the location of the tool using stack:
stack path --local-bin
- Use curl to download the home page from haskell.org (http://www.haskell.org/):
curl -X GET http://www.haskell.org -o index.html
- Use blaze-from-html to engineer the blaze DSL from the HTML page:
blaze-from-html -v html5 -s index.html > index.hs...