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.  forkIO and signal handlers (Michael Litchard)
   2. Re:  forkIO and signal handlers (Michael Litchard)
   3. Re:  forkIO and signal handlers (Brandon Allbery)
   4. Re:  forkIO and signal handlers (Michael Litchard)
   5. Re:  forkIO and signal handlers (Michael Litchard)
   6. Re:  forkIO and signal handlers (David McBride)
   7.  Attoparsec and multiline comments (Alexander.Vladislav.Popov )


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

Message: 1
Date: Fri, 9 Sep 2011 12:06:40 -0700
From: Michael Litchard <mich...@schmong.org>
Subject: [Haskell-beginners] forkIO and signal handlers
To: beginners@haskell.org
Message-ID:
        <CAEzeKYpRBHHZA=ohzxn-fw+el6dhaugunmzbzbfs1vxwuor...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I am trying to use installHandler with forkIO.
I'd like to fork a process in Main when a signal is caught, having
trouble with the types and I'm sure there is a convention I'm not
familiar with.
Could I see an example of how this is done?



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

Message: 2
Date: Fri, 9 Sep 2011 12:35:56 -0700
From: Michael Litchard <mich...@schmong.org>
Subject: Re: [Haskell-beginners] forkIO and signal handlers
To: Tim Perry <tim.pe...@lifetime.oregonstate.edu>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <caezekyrqcz7dwhzy-ofq8_zxl9ozk-rdy0puf2wrartyuws...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the reply. The problem isn't signal handling, nor is it
using forkIO. It's using both of them together.

On Fri, Sep 9, 2011 at 12:14 PM, Tim Perry
<tim.pe...@lifetime.oregonstate.edu> wrote:
> There is an example of forking processes in the "Real World Haskell" book in
> chapter 20 - Systems Programming.
> http://book.realworldhaskell.org/read/systems-programming-in-haskell.html
>
> Unfortunately I don't think it covers catching signals. I hope this helps.
> Tim
> ________________________________
> From: Michael Litchard <mich...@schmong.org>
> To: beginners@haskell.org
> Sent: Friday, September 9, 2011 12:06 PM
> Subject: [Haskell-beginners] forkIO and signal handlers
>
> I am trying to use installHandler with forkIO.
> I'd like to fork a process in Main when a signal is caught, having
> trouble with the types and I'm sure there is a convention I'm not
> familiar with.
> Could I see an example of how this is done?
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
>



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

Message: 3
Date: Fri, 9 Sep 2011 15:46:19 -0400
From: Brandon Allbery <allber...@gmail.com>
Subject: Re: [Haskell-beginners] forkIO and signal handlers
To: Michael Litchard <mich...@schmong.org>
Cc: Tim Perry <tim.pe...@lifetime.oregonstate.edu>,
        "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <cakfcl4u73unpsmnmgl2kom8c5-tzlzhtyff2kb79hljbz8g...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Fri, Sep 9, 2011 at 15:35, Michael Litchard <mich...@schmong.org> wrote:

> Thanks for the reply. The problem isn't signal handling, nor is it
> using forkIO. It's using both of them together.
>

I think you'll have to provide an example of what you're trying to do and
the error message you get.

-- 
brandon s allbery                                      allber...@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110909/91370c95/attachment-0001.htm>

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

Message: 4
Date: Fri, 9 Sep 2011 12:53:27 -0700
From: Michael Litchard <mich...@schmong.org>
Subject: Re: [Haskell-beginners] forkIO and signal handlers
To: Brandon Allbery <allber...@gmail.com>
Cc: Tim Perry <tim.pe...@lifetime.oregonstate.edu>,
        "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <caezekyolchposmxkad7ghbxsr08lmzw2bixhzqjsaddntfm...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Here's the error message. The problem is clear, not sure what to do
about it. My broken code should show my intent though.

> main :: IO ()
> main = do
>     let world = (newEmptyTMVar :: ProcessState)
>     let jCount = (newEmptyTMVar :: JobCount)
>     installHandler userDefinedSignal1 (forkIO $ Catch $ worldHandler world 
> jCount) Nothing
>     sequence_ $ repeat $ worldCheck

I'd like to fork in Main. Right now I'm forking in worldHandler. If
that's what I have to do, then I'll just move on. But I'd like to keep
the forkIO call in Main if possible.


On Fri, Sep 9, 2011 at 12:46 PM, Brandon Allbery <allber...@gmail.com> wrote:
> On Fri, Sep 9, 2011 at 15:35, Michael Litchard <mich...@schmong.org> wrote:
>>
>> Thanks for the reply. The problem isn't signal handling, nor is it
>> using forkIO. It's using both of them together.
>
> I think you'll have to provide an example of what you're trying to do and
> the error message you get.
> --
> brandon s allbery ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?allber...@gmail.com
> wandering unix systems administrator (available) ? ? (412) 475-9364 vm/sms
>
>



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

Message: 5
Date: Fri, 9 Sep 2011 12:54:21 -0700
From: Michael Litchard <mich...@schmong.org>
Subject: Re: [Haskell-beginners] forkIO and signal handlers
To: Brandon Allbery <allber...@gmail.com>
Cc: Tim Perry <tim.pe...@lifetime.oregonstate.edu>,
        "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <caezekyrdujvq3yanwhusffhblgp3dl4fmhrqw8ny37fyxsb...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

forgot to paste in the error message, oops

copy_take.lhs:48:51:
    Couldn't match expected type `IO ()' with actual type `Handler'
    In the second argument of `($)', namely
      `Catch $ worldHandler world jCount'
    In the second argument of `installHandler', namely
      `(forkIO $ Catch $ worldHandler world jCount)'
    In a stmt of a 'do' expression:
        installHandler
          userDefinedSignal1
          (forkIO $ Catch $ worldHandler world jCount)
          Nothing
Failed, modules loaded:

On Fri, Sep 9, 2011 at 12:53 PM, Michael Litchard <mich...@schmong.org> wrote:
> Here's the error message. The problem is clear, not sure what to do
> about it. My broken code should show my intent though.
>
>> main :: IO ()
>> main = do
>> ? ? let world = (newEmptyTMVar :: ProcessState)
>> ? ? let jCount = (newEmptyTMVar :: JobCount)
>> ? ? installHandler userDefinedSignal1 (forkIO $ Catch $ worldHandler world 
>> jCount) Nothing
>> ? ? sequence_ $ repeat $ worldCheck
>
> I'd like to fork in Main. Right now I'm forking in worldHandler. If
> that's what I have to do, then I'll just move on. But I'd like to keep
> the forkIO call in Main if possible.
>
>
> On Fri, Sep 9, 2011 at 12:46 PM, Brandon Allbery <allber...@gmail.com> wrote:
>> On Fri, Sep 9, 2011 at 15:35, Michael Litchard <mich...@schmong.org> wrote:
>>>
>>> Thanks for the reply. The problem isn't signal handling, nor is it
>>> using forkIO. It's using both of them together.
>>
>> I think you'll have to provide an example of what you're trying to do and
>> the error message you get.
>> --
>> brandon s allbery ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?allber...@gmail.com
>> wandering unix systems administrator (available) ? ? (412) 475-9364 vm/sms
>>
>>
>



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

Message: 6
Date: Fri, 9 Sep 2011 16:09:37 -0400
From: David McBride <dmcbr...@neondsl.com>
Subject: Re: [Haskell-beginners] forkIO and signal handlers
To: Michael Litchard <mich...@schmong.org>
Cc: Tim Perry <tim.pe...@lifetime.oregonstate.edu>,
        "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <CAN+Tr43KHjxf6CNcPqR==0aw6fexkypyq6qqww0zvawu4xw...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Handler is not IO (), it is a handler.  Try this:

installHandler userDefinedSignal1 (Catch (forkIO (worldHandler world
jCount) >> return ())) Nothing

On Fri, Sep 9, 2011 at 3:54 PM, Michael Litchard <mich...@schmong.org> wrote:
> forgot to paste in the error message, oops
>
> copy_take.lhs:48:51:
> ? ?Couldn't match expected type `IO ()' with actual type `Handler'
> ? ?In the second argument of `($)', namely
> ? ? ?`Catch $ worldHandler world jCount'
> ? ?In the second argument of `installHandler', namely
> ? ? ?`(forkIO $ Catch $ worldHandler world jCount)'
> ? ?In a stmt of a 'do' expression:
> ? ? ? ?installHandler
> ? ? ? ? ?userDefinedSignal1
> ? ? ? ? ?(forkIO $ Catch $ worldHandler world jCount)
> ? ? ? ? ?Nothing
> Failed, modules loaded:
>
> On Fri, Sep 9, 2011 at 12:53 PM, Michael Litchard <mich...@schmong.org> wrote:
>> Here's the error message. The problem is clear, not sure what to do
>> about it. My broken code should show my intent though.
>>
>>> main :: IO ()
>>> main = do
>>> ? ? let world = (newEmptyTMVar :: ProcessState)
>>> ? ? let jCount = (newEmptyTMVar :: JobCount)
>>> ? ? installHandler userDefinedSignal1 (forkIO $ Catch $ worldHandler world 
>>> jCount) Nothing
>>> ? ? sequence_ $ repeat $ worldCheck
>>
>> I'd like to fork in Main. Right now I'm forking in worldHandler. If
>> that's what I have to do, then I'll just move on. But I'd like to keep
>> the forkIO call in Main if possible.
>>
>>
>> On Fri, Sep 9, 2011 at 12:46 PM, Brandon Allbery <allber...@gmail.com> wrote:
>>> On Fri, Sep 9, 2011 at 15:35, Michael Litchard <mich...@schmong.org> wrote:
>>>>
>>>> Thanks for the reply. The problem isn't signal handling, nor is it
>>>> using forkIO. It's using both of them together.
>>>
>>> I think you'll have to provide an example of what you're trying to do and
>>> the error message you get.
>>> --
>>> brandon s allbery ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?allber...@gmail.com
>>> wandering unix systems administrator (available) ? ? (412) 475-9364 vm/sms
>>>
>>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



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

Message: 7
Date: Sat, 10 Sep 2011 14:05:56 +0600
From: "Alexander.Vladislav.Popov "
        <alexander.vladislav.po...@gmail.com>
Subject: [Haskell-beginners] Attoparsec and multiline comments
To: beginners@haskell.org
Message-ID:
        <calpbq9au8cd1pur-jhgomhmsll1tf-rs27a3puqtbxp3a6n...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear haskellers,

Help me to parse multiline comments (like /* ... */ or even like /*- ...
-*/) using attoparsec.

Thanks in advance, Alexander.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110910/dad22167/attachment-0001.htm>

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

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


End of Beginners Digest, Vol 39, Issue 11
*****************************************

Reply via email to