Send Beginners mailing list submissions to
[email protected]
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
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. pcap example? (Patrick LeBoutillier)
2. Re: pcap example? (Antoine Latter)
3. Re: uses for Functor or Applicative? (Heinrich Apfelmus)
4. Re: Re: uses for Functor or Applicative? (Johann Bach)
5. Invoke an external command (Hong Yang)
----------------------------------------------------------------------
Message: 1
Date: Fri, 23 Jul 2010 16:57:45 -0400
From: Patrick LeBoutillier <[email protected]>
Subject: [Haskell-beginners] pcap example?
To: beginners <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
I've noticed a pcap package on hackagem but by looking at the hackage
docs I have no idea on how to use it.
Can anyone provide a simple example?
Thanks,
Patrick
--
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada
------------------------------
Message: 2
Date: Fri, 23 Jul 2010 16:55:06 -0500
From: Antoine Latter <[email protected]>
Subject: Re: [Haskell-beginners] pcap example?
To: Patrick LeBoutillier <[email protected]>
Cc: Bryan O'Sullivan <[email protected]>, beginners
<[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=UTF-8
On Fri, Jul 23, 2010 at 3:57 PM, Patrick LeBoutillier
<[email protected]> wrote:
> Hi all,
>
> I've noticed a pcap package on hackagem but by looking at the hackage
> docs I have no idea on how to use it.
> Can anyone provide a simple example?
>
Hi Patrick,
I'm CCing the maintainer of the package, as he's likely in the best
position to know how it is to be used.
Antoine
------------------------------
Message: 3
Date: Sat, 24 Jul 2010 12:44:31 +0200
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: uses for Functor or Applicative?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Johann Bach wrote:
> I'm wondering if the following problem might reveal a use for Functor
> or Applicative, or just generally something cooler than I'm doing now.
>
> I have a music document as type MusDoc. It has [Part]. Part has
> [Note]. I have defined them using field names because I am
> deliberating allowing for this to get more complicated later.
>
> The question is about mapping functions over the individual parts. I
> often find myself wanting to alter or
> filter all the parts. In the following example I define filterDoc with
> a couple of helper functions. What I
> would like to know: is there a cooler way to do this using instances
> of Functor or something? Defining
> operators?
You could make the types polymorphic to be able to make a functor
instance, but it's not necessarily a good idea.
In any case, you may want to have a look at functional references
http://article.gmane.org/gmane.comp.lang.haskell.cafe/28094
One implementation of functional references is
http://hackage.haskell.org/package/data-accessor
Then, you can for instance write
parts :: Accessor MusDoc [Part]
notes :: Accessor Part [Notes]
example :: MusDoc -> MusDoc
example = modify parts . map . modify notes $ filter (== CSharp)
where notes and parts are two appropriate functional references,
which are best generated automatically.
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
------------------------------
Message: 4
Date: Sat, 24 Jul 2010 04:14:09 -0700
From: Johann Bach <[email protected]>
Subject: Re: [Haskell-beginners] Re: uses for Functor or Applicative?
To: Heinrich Apfelmus <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Thanks, everyone. I will look up some of these ideas.
I hadn't thought of the fact that Functor has kind *->*. (Googly-eyed
Pinnochio? Just kidding.) I just thought that my data types contained other
types.
-Johann
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100724/1d170314/attachment-0001.html
------------------------------
Message: 5
Date: Sat, 24 Jul 2010 09:55:41 -0500
From: Hong Yang <[email protected]>
Subject: [Haskell-beginners] Invoke an external command
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi,
I am trying to pass on arguments and standard input to an external command,
and get back its standard output real time.
I used "readProcess" from "System.Process" module. It is working fine except
that the output is returned strictly, i.e., the output was dumped to the
screen all at once when the command was finished.
I also tried HSH module and it acted the same as readProcess:
runIO $ setenv [("TERM", standard_input)] $ "echo $TERM" -|- (command ++ " "
++ (intercalate " " argsListOfStrings)).
Can anyone help me?
Thanks,
Hong
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100724/2b2b357f/attachment-0001.html
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 25, Issue 49
*****************************************