[Haskell-beginners] Help me with designing my daemon, please.

David McBride dmcbride at neondsl.com
Wed Sep 7 21:22:35 CEST 2011

It sounds bizarre.  Why pass around an mvar in tchan, when you could
just pass a maybe around and pattern match to see if it is Nothing or
not?  Also, why have forkio and tchan at all if they are only going to
operate in sequence, one at a time?

What exactly are you trying to do?

On Wed, Sep 7, 2011 at 3:01 PM, Michael Litchard <michael at schmong.org> wrote:
> I have a daemon I need to build, and need to work out some design
> details I am having difficulty with. Here's what the design looks like
> right now
> When the daemon starts it creates an empty MVar and an empty TChan.
> Then it listens for a usrSIG1.
> when it gets one, it checks to see if the MVar is empty. If it is, it
> does some stuff to fill the MVar, which is then used to pass around
> state for a list of functions. These functions are always the same.
> After evaluating these functions, the TChan is checked. As long as the
> TChan has something in it,
> it populates an MVar and the same three functions are evaluated in the
> same order again.
> If the MVar is full, it creates another MVar of the same type and puts
> it in the TChan.
> Is this a sound design? Does it prompt any questions from you? Here's
> my question. If this is basically a sound design, I know I will need
> use forkIO. I'm not sure where.
> If this is not a sound design, please ask questions or give other
> feedback so I can make changes and restore sanity.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list