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

2010-11-02 Thread Michael Litchard
I have the following TagOpen [TagOpen a [(href,/launchWebForward.do?resourceId=4policy=0returnTo=%2FshowWebForwards.do)]] I would like to get the attribute resourceId=4 from that. My understanding is that fromAttrib is the right thing to use. But I'm having difficulty understanding the type

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

2010-11-02 Thread Daniel Fischer
On Tuesday 02 November 2010 22:17:48, Michael Litchard wrote: I have the following TagOpen [TagOpen a [(href,/launchWebForward.do?resourceId=4policy=0returnTo=%2FshowWeb Forwards.do)]] I would like to get the attribute resourceId=4 from that. My understanding is that fromAttrib is the right

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

2010-11-02 Thread Michael Litchard
Daniel, Thank you for your reply. I'm still confused. When I see a code sample like this main = do posts - liftM parseTags (readFile posts.xml) print $ head $ map (fromAttrib Id) $ filter (~== (row OwnerUserId= ++ userid ++ )) posts I have no idea

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

2010-11-02 Thread Christopher Done
On 2 November 2010 22:40, Michael Litchard mich...@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

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

2010-11-02 Thread Daniel Schoepe
Excerpts from Michael Litchard's message of Tue Nov 02 22:40:27 +0100 2010: Daniel, Thank you for your reply. I'm still confused. When I see a code sample like this main = do posts - liftM parseTags (readFile posts.xml) print $ head $ map (fromAttrib Id) $

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

2010-11-02 Thread Michael Litchard
Ah thank you. I can go ahead and figure out how to parse that string. Using a regex is tempting but I have a feeling I can get something more maintainable if I use another approach. On Tue, Nov 2, 2010 at 2:52 PM, Daniel Schoepe daniel.scho...@googlemail.com wrote: Excerpts from Michael

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

2010-11-02 Thread Neil Mitchell
Hi Michael, If you just replace all 'str' with 'String' when reading the signature then that will almost certainly be sufficient for your purposes. So read it as: fromAttrib :: String - Tag String - String Where Tag String can be thought of as just Tag. If you try to parse HTML with regular