v3.ocaml.org-rescript
v3.ocaml.org-rescript copied to clipboard
Consider a more compelling example for the front page
The current front-page example is a nice but impractical finger-exercise. It would be nice to have something more realistic. Here's a kind of example that might be fun, which you could get if you linked in the lambdasoup package:
# let get_hrefs soup =
Soup.select "a" soup
|> Soup.to_list
|> List.map (Soup.R.attribute "href")
;;
val get_hrefs : 'a Soup.node -> string list = <fun>
# get_hrefs (Soup.parse {|
<html><body>
<a href="https://ocaml.org"> This is a link! </a>
And here's <a href="https://github.com/ocaml">another one</a>. |});;
- : string list = ["http://ocaml.org"; https://github.com/ocaml"]
I think something like that could be a lot more compelling.