[Haskell-cafe] trying to use Tag Soup - fromAttrib

Christopher Done chrisdone at googlemail.com
Tue Nov 2 17:48:47 EDT 2010

On 2 November 2010 22:40, Michael Litchard <michael at schmong.org> wrote:
> fromAttrib :: (Show str, Eq str, StringLike str) => str -> Tag str -> str
> seems to say "fromAttrib takes two parameters (I know it doesn't
> literally take two), one str (with the constraints in parenthesis to
> the left) and one str of type Tag, giving back a str. Then I look at
> the above code sample and can't match the two up.

It's one string-like (String, ByteString, etc.) value `str`, and one
*Tag* which contains, in its attributes and text contents, string-like
values, also `str`. It extracts this `str` from the `Tag str` (tag of
string-like `str`).

The reason Tag is parametrized over the String type is so that you can
use TagSoup with String (normal case), or ByteString for when you need
speed, or Text, or whatever string type you need that implements the
StringLike type.

More information about the Haskell-Cafe mailing list