how to add monad-stack to network-conduit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to add monad-stack to network-conduit

Alexander Vershilov
Hello.

I have got next problem: I want to have database connection pool
in server based on network-conduit.
So I wanted to be able to do

> runTCPServer options action
>   where
>     action src snk =
>       pool <- ask
>       ....
>          

In this situation I can make pool `action's parameter, but in more
difficult situations (many methods inside) is would be painfull.

Also I wanted to have some kind of State for each thread, e.g.

> action src snk = src $= act1 $= act2 $= act3 $$ snk

in act1, act2, act3 I want to read and change state.

Is it possible? And how to do it if it is?

--
Alexander Vershilov

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (501 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to add monad-stack to network-conduit

Michael Snoyman
On Tue, Feb 21, 2012 at 5:10 PM, Alexander V Vershilov
<[hidden email]> wrote:

> Hello.
>
> I have got next problem: I want to have database connection pool
> in server based on network-conduit.
> So I wanted to be able to do
>
>> runTCPServer options action
>>   where
>>     action src snk =
>>       pool <- ask
>>       ....
>>
>
> In this situation I can make pool `action's parameter, but in more
> difficult situations (many methods inside) is would be painfull.
>
> Also I wanted to have some kind of State for each thread, e.g.
>
>> action src snk = src $= act1 $= act2 $= act3 $$ snk
>
> in act1, act2, act3 I want to read and change state.
>
> Is it possible? And how to do it if it is?
>
> --
> Alexander Vershilov
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

It should just be a matter of relaxing the type signatures in
network-conduit. I'll include that in the next release.

Michael

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: how to add monad-stack to network-conduit

Alexander Vershilov
Wed, Feb 22, 2012 at 01:58:02PM +0200, Michael Snoyman wrote

> On Tue, Feb 21, 2012 at 5:10 PM, Alexander V Vershilov
> <[hidden email]> wrote:
> > Hello.
> >
> > I have got next problem: I want to have database connection pool
> > in server based on network-conduit.
> > So I wanted to be able to do
> >
> >> runTCPServer options action
> >>   where
> >>     action src snk =
> >>       pool <- ask
> >>       ....
> >>
> >
> > In this situation I can make pool `action's parameter, but in more
> > difficult situations (many methods inside) is would be painfull.
> >
> > Also I wanted to have some kind of State for each thread, e.g.
> >
> >> action src snk = src $= act1 $= act2 $= act3 $$ snk
> >
> > in act1, act2, act3 I want to read and change state.
> >
> > Is it possible? And how to do it if it is?
> >
> > --
> > Alexander Vershilov
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > [hidden email]
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>
> It should just be a matter of relaxing the type signatures in
> network-conduit. I'll include that in the next release.
>
> Michael
Thanks.

--
Alexander Vershilov

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (501 bytes) Download Attachment