fimad / scalpel

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

Make "withAll" always succeed #44

Closed haasn closed 8 years ago

haasn commented 8 years ago

I need to match a field that may be optional. I figured I could use the ‘plural’ versions of selectors (e.g. texts) plus something like listToMaybe to ‘safely’ match only the first occurrence of an element, but this does not work as expected.

To my great surprise, texts also fails matching anything if there are 0 elements, which I did not expect. I expected it to return an empty list (like ‘many’ in Parsec). In keeping with the principle of least surprise, I would recommend changing the semantics of these matchers.