Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Distributing executables (Magnus Therning)
   2. Re:  Distributing executables (Magnus Therning)
   3. Re:  Distributing executables (Lyndon Maydwell)
   4.  Can you identify this recursion pattern please?
      (Colin Paul Adams)
   5. Re:  Can you identify this recursion pattern      please?
      (Colin Paul Adams)
   6.  remove XML tags using Text.Regex.Posix (Robert Ziemba)
   7. Re:  remove XML tags using Text.Regex.Posix (Colin Paul Adams)
   8. Re:  remove XML tags using Text.Regex.Posix (Patrick LeBoutillier)
   9. Re:  remove XML tags using Text.Regex.Posix (Magnus Therning)


----------------------------------------------------------------------

Message: 1
Date: Tue, 29 Sep 2009 10:30:44 +0100
From: Magnus Therning <mag...@therning.org>
Subject: Re: [Haskell-beginners] Distributing executables
To: Lyndon Maydwell <maydw...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <e040b520909290230w76977dedj3de0c8b3781a6...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Tue, Sep 29, 2009 at 10:19 AM, Lyndon Maydwell <maydw...@gmail.com> wrote:
> No love for OS X?

No, not from me personally ;-)

Seriously, I simply don't know anything about OSX.  I've never owned a
McComputer.  Though I suspect OSX isn't quite as broken as Windows in
relation to installers.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


------------------------------

Message: 2
Date: Tue, 29 Sep 2009 10:32:52 +0100
From: Magnus Therning <mag...@therning.org>
Subject: Re: [Haskell-beginners] Distributing executables
To: Alp Mestan <a...@mestan.fr>
Cc: beginners@haskell.org
Message-ID:
        <e040b520909290232u2d841050qe0a712518eece...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Tue, Sep 29, 2009 at 10:29 AM, Alp Mestan <a...@mestan.fr> wrote:
> On Tue, Sep 29, 2009 at 11:19 AM, Lyndon Maydwell <maydw...@gmail.com>
> wrote:
>>
>> No love for OS X?
>
> No knowledge of OS X binary/library interactions, actually :-)
>
> Magnus : I agree about Linux. At least, a cabal package is enough, since
> there are a lot of cabal-to-<insert distro package format here> tools
> around. For Windows, which tool do you know that'd make it for Haskell apps
> ?

I don't know of any Haskell-specific ones, but I'd be surprised if you
can't make NSIS or WiX create an installer for a Haskell binary.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


------------------------------

Message: 3
Date: Tue, 29 Sep 2009 17:35:28 +0800
From: Lyndon Maydwell <maydw...@gmail.com>
Subject: Re: [Haskell-beginners] Distributing executables
To: Magnus Therning <mag...@therning.org>
Cc: beginners@haskell.org
Message-ID:
        <da8fea9e0909290235g3c726338v1a250a4f2ade9...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I was thinking more along the lines of how reasonable it would be to
ask a non-technical user to build a program you wish to distribute
from source. On linux / bsd /etc it would probably be unsurprising,
but it may be asking too much of windows and mac users.

On Tue, Sep 29, 2009 at 5:30 PM, Magnus Therning <mag...@therning.org> wrote:
> On Tue, Sep 29, 2009 at 10:19 AM, Lyndon Maydwell <maydw...@gmail.com> wrote:
>> No love for OS X?
>
> No, not from me personally ;-)
>
> Seriously, I simply don't know anything about OSX.  I've never owned a
> McComputer.  Though I suspect OSX isn't quite as broken as Windows in
> relation to installers.
>
> /M
>
> --
> Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
> magnus@therning.org          Jabber: magnus@therning.org
> http://therning.org/magnus         identi.ca|twitter: magthe
>


------------------------------

Message: 4
Date: Tue, 29 Sep 2009 18:02:40 +0100
From: Colin Paul Adams <co...@colina.demon.co.uk>
Subject: [Haskell-beginners] Can you identify this recursion pattern
        please?
To: beginners@haskell.org
Message-ID: <m34oql7kgf....@colina.demon.co.uk>
Content-Type: text/plain; charset=us-ascii

This looks like some kind of unfold to me. Can you help?

I have the following code that works for the first two levels:

  -- get the list of all (recursive) child gallery names
  -- first, just the immediate children
  childNames <- childGalleries db (name gallery)
  -- now let's try the next level
  grandchildren <- mapM (childGalleries db) childNames
  mapM putStrLn (childNames ++ concat grandchildren)

The database query childGalleries gives me a list of all the immediate
children.
So what I want is recursively, the names of all the descendants, as
well as the original name, concatenated to a flat list. I'm struggling
to identify the higher-order recursion function I need.
-- 
Colin Adams
Preston Lancashire


------------------------------

Message: 5
Date: Tue, 29 Sep 2009 19:51:23 +0100
From: Colin Paul Adams <co...@colina.demon.co.uk>
Subject: Re: [Haskell-beginners] Can you identify this recursion
        pattern please?
To: beginners@haskell.org
Message-ID: <m3zl8d60us....@colina.demon.co.uk>
Content-Type: text/plain; charset=us-ascii

>>>>> "Colin" == Colin Paul Adams <co...@colina.demon.co.uk> writes:

    Colin> The database query childGalleries gives me a list of all
    Colin> the immediate children.  So what I want is recursively, the
    Colin> names of all the descendants, as well as the original name,
    Colin> concatenated to a flat list. I'm struggling to identify the
    Colin> higher-order recursion function I need.
    
I worked out that Data.Tree.unfoldM_BF was what I needed.

-- 
Colin Adams
Preston Lancashire


------------------------------

Message: 6
Date: Tue, 29 Sep 2009 12:25:07 -0700
From: Robert Ziemba <rzie...@gmail.com>
Subject: [Haskell-beginners] remove XML tags using Text.Regex.Posix
To: beginners@haskell.org
Message-ID:
        <65135790909291225ge73308emb0891250638c5...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I have been working with the regular expression package (Text.Regex.Posix).
 My hope was to find a simple way to remove a pair of XML tags from a short
string.

I have something like this "<tag>Data</tag>" and would like to extract
'Data'.  There is only one tag pair, no nesting, and I know exactly what the
tag is.

My first attempt was this:

  "<tag>123</tag>" =~ "[^<tag>].+[^</tag>]"::String

result:  "123"

Upon further experimenting I realized that it only works with more than 2
digits in 'Data'.  I occured to me that my thinking on how this regular
expression works was not correct - but I don't understand why it works at
all for 3 or more digits.

Can anyone help me understand this result and perhaps suggest another
strategy?  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090929/77d2a447/attachment-0001.html

------------------------------

Message: 7
Date: Tue, 29 Sep 2009 20:33:51 +0100
From: Colin Paul Adams <co...@colina.demon.co.uk>
Subject: Re: [Haskell-beginners] remove XML tags using
        Text.Regex.Posix
To: Robert Ziemba <rzie...@gmail.com>
Cc: beginners@haskell.org
Message-ID: <m3vdj15yw0....@colina.demon.co.uk>
Content-Type: text/plain; charset=us-ascii

>>>>> "Robert" == Robert Ziemba <rzie...@gmail.com> writes:

    Robert> Can anyone help me understand this result and perhaps
    Robert> suggest another strategy?

I can manage the latter - use an XML parser to extract the text.
-- 
Colin Adams
Preston Lancashire


------------------------------

Message: 8
Date: Tue, 29 Sep 2009 16:29:52 -0400
From: Patrick LeBoutillier <patrick.leboutill...@gmail.com>
Subject: Re: [Haskell-beginners] remove XML tags using
        Text.Regex.Posix
To: Robert Ziemba <rzie...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <b217a64f0909291329x8020420jb41afe651c0c6...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Robert,

On Tue, Sep 29, 2009 at 3:25 PM, Robert Ziemba <rzie...@gmail.com> wrote:

> I have been working with the regular expression package (Text.Regex.Posix).
>  My hope was to find a simple way to remove a pair of XML tags from a short
> string.
>
> I have something like this "<tag>Data</tag>" and would like to extract
> 'Data'.  There is only one tag pair, no nesting, and I know exactly what the
> tag is.
>
> My first attempt was this:
>
>   "<tag>123</tag>" =~ "[^<tag>].+[^</tag>]"::String
>
> result:  "123"
>
> Upon further experimenting I realized that it only works with more than 2
> digits in 'Data'.  I occured to me that my thinking on how this regular
> expression works was not correct - but I don't understand why it works at
> all for 3 or more digits.
>
> Can anyone help me understand this result and perhaps suggest another
> strategy?  Thank you.
>

The regex you are using here can be described as such:

"Match a character not in the set '<,t,a,g,>', followed by 1 or more of
anything, followed by a character not in the set '<,/,t,a,g,>'."

Effectively, it will not match if your data has less than 3 characters and
is probably not the correct regex for this job, i.e. it would also match
"x123x". What you need is regex capturing, but I don't know if that is
available in that regex library (I'm not an expert Haskeller).

If you really need a regex to locate the tag, you could use a function like
this to extract it:

getTagData tag s =
   let match = s =~ ("<" ++ tag ++ ">.*</" ++ tag ++ ">")::String
       dropTag = drop (length tag + 2) s
       getData = take (length match - (2 * length tag + 5)) dropTag
  in if length match > 0
       then Just getData
       else Nothing

*Main> getTagData "tag" "<tag>123</tag>"
Just "123"


Patrick



> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090929/46415b74/attachment-0001.html

------------------------------

Message: 9
Date: Wed, 30 Sep 2009 06:58:35 +0100
From: Magnus Therning <mag...@therning.org>
Subject: Re: [Haskell-beginners] remove XML tags using
        Text.Regex.Posix
To: beginners@haskell.org
Message-ID: <20090930055835.gb3...@tatooine>
Content-Type: text/plain; charset="utf-8"

On Tue, Sep 29, 2009 at 12:25:07PM -0700, Robert Ziemba wrote:
> I have been working with the regular expression package (Text.Regex.Posix).
>  My hope was to find a simple way to remove a pair of XML tags from a short
> string.
> 
> I have something like this "<tag>Data</tag>" and would like to extract
> 'Data'.  There is only one tag pair, no nesting, and I know exactly what the
> tag is.
> 
> My first attempt was this:
> 
>   "<tag>123</tag>" =~ "[^<tag>].+[^</tag>]"::String
> 
> result:  "123"
> 
> Upon further experimenting I realized that it only works with more than 2
> digits in 'Data'.  I occured to me that my thinking on how this regular
> expression works was not correct - but I don't understand why it works at
> all for 3 or more digits.
> 
> Can anyone help me understand this result and perhaps suggest another
> strategy?  Thank you.

Personally I would have used tagsoup for this sort of thing.  Keep in mind the
eternal words

  Some people, when confronted with a problem, think 'I know, I'll use
  regular expressions.' Now they have two problems.
       -- Jamie Zawinski

As you so nicely demonstrated yourself ;-)

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : 
http://www.haskell.org/pipermail/beginners/attachments/20090930/bfc363ea/attachment.bin

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 15, Issue 20
*****************************************

Reply via email to