fimad / scalpel

A high level web scraping library for Haskell.
Apache License 2.0
323 stars 43 forks source link

"fail" implementation #43

Closed haasn closed 8 years ago

haasn commented 8 years ago

It would be great if you could add fail _ = mzero to Selector str's Monad instance.

This would allow me to cleanly pattern match inside selectors, like this:

do Just x <- fmap readMaybe . text $ "foo" // "bar"
   ...

This selector would fail without throwing an error when the tag in question can't be parsed as an integer.