Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion MonadBaseControl IO instance for Handlers

Received: by 10.68.238.198 with SMTP id vm6mr9043577pbc.3.1328451123223;
        Sun, 05 Feb 2012 06:12:03 -0800 (PST)
X-BeenThere: snapframework@googlegroups.com
Received: by 10.68.227.166 with SMTP id sb6ls22532965pbc.0.gmail; Sun, 05 Feb
 2012 06:12:03 -0800 (PST)
Received: by 10.68.73.229 with SMTP id o5mr9029785pbv.7.1328451123081;
        Sun, 05 Feb 2012 06:12:03 -0800 (PST)
Received: by 10.68.73.229 with SMTP id o5mr9029784pbv.7.1328451123069;
        Sun, 05 Feb 2012 06:12:03 -0800 (PST)
Return-Path: <snap+bncCOr0wo_aDhCunLr5BBoEl5y...@snapframework.com>
Received: from mail-pz0-f71.google.com (mail-pz0-f71.google.com [209.85.210.71])
        by gmr-mx.google.com with ESMTPS id c6si12012537pbo.0.2012.02.05.06.12.03
        (version=TLSv1/SSLv3 cipher=OTHER);
        Sun, 05 Feb 2012 06:12:03 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.210.71 is neither permitted nor denied by best guess record for domain of snap+bncCOr0wo_aDhCunLr5BBoEl5y...@snapframework.com) client-ip=209.85.210.71;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.210.71 is neither permitted nor denied by best guess record for domain of snap+bncCOr0wo_aDhCunLr5BBoEl5y...@snapframework.com) smtp.mail=snap+bncCOr0wo_aDhCunLr5BBoEl5y...@snapframework.com
Received: by dadn15 with SMTP id n15sf6660381dad.10
        for <snapframework+garchive-17192@googlegroups.com>; Sun, 05 Feb 2012 06:12:03 -0800 (PST)
Received: by 10.68.226.10 with SMTP id ro10mr9027020pbc.6.1328451118290;
        Sun, 05 Feb 2012 06:11:58 -0800 (PST)
X-BeenThere: s...@snapframework.com
Received: by 10.68.120.102 with SMTP id lb6ls22512932pbb.6.gmail; Sun, 05 Feb
 2012 06:11:57 -0800 (PST)
Received: by 10.68.132.166 with SMTP id ov6mr16360565pbb.122.1328451117843;
        Sun, 05 Feb 2012 06:11:57 -0800 (PST)
Received: by 10.68.132.166 with SMTP id ov6mr16360562pbb.122.1328451117834;
        Sun, 05 Feb 2012 06:11:57 -0800 (PST)
Received: from nk11p99mm-asmtpout007.mac.com (nk11p03mm-asmtp997.mac.com. [17.158.233.228])
        by mx.google.com with ESMTP id l7si16834222pbd.227.2012.02.05.06.11.57;
        Sun, 05 Feb 2012 06:11:57 -0800 (PST)
Received-SPF: pass (google.com: domain of j.stutterh...@me.com designates 17.158.233.228 as permitted sender) client-ip=17.158.233.228;
MIME-version: 1.0
Received: from [192.168.1.31] (219-4-223.ftth.xms.internl.net [85.223.4.219])
 by nk11p03mm-asmtp997.mac.com
 (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug
 10 2011)) with ESMTPSA id <0LYX00E5RBFAO...@nk11p03mm-asmtp997.mac.com> for
 s...@snapframework.com; Sun, 05 Feb 2012 14:11:37 +0000 (GMT)
X-Proofpoint-Virus-Version: vendor=fsecure
 engine=2.50.10432:5.6.7361,1.0.260,0.0.0000
 definitions=2012-02-05_03:2012-02-03,2012-02-05,1970-01-01 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam
 adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000
 definitions=main-1202050104
Subject: Re: MonadBaseControl IO instance for Handlers
From: =?iso-8859-1?Q?Jurri=EBn_Stutterheim?= <j.stutterh...@me.com>
In-reply-to: <CAHZrzdqQfTLkESwO2rYurDVtdCbH_=io5Y5tvdsVMOf6p6G...@mail.gmail.com>
Date: Sun, 05 Feb 2012 15:11:33 +0100
Cc: Dmitry Dzhus <d...@dzhus.org>, s...@snapframework.com,
 Jasper Van der Jeugt <jasper...@gmail.com>
Message-id: <63CFDEBC-6632-47FB-AFEE-3E999EEA0...@me.com>
References: <440891328435...@web56.yandex.ru>
 <CAHZrzdqQfTLkESwO2rYurDVtdCbH_=io5Y5tvdsVMOf6p6G...@mail.gmail.com>
To: Gregory Collins <g...@gregorycollins.net>
X-Mailer: Apple Mail (2.1257)
X-Original-Sender: j.stutterh...@me.com
X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain
 of j.stutterh...@me.com designates 17.158.233.228 as permitted sender) smtp.mail=j.stutterh...@me.com
Precedence: list
Mailing-list: list s...@snapframework.com; contact snap+own...@snapframework.com
List-ID: <snap.snapframework.com>
List-Help: <http://www.google.com/support/a/snapframework.com/bin/static.py?hl=en_US&page=groups.cs>,
 <mailto:snap+h...@snapframework.com>
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable

I've made an attempt to port Snap to monad-control, but it broke the =
entire framework in non-obvious ways. It is possible to define a =
`MonadControlIO` instance for `Handler`, though (monad-control-0.2.x). =
That would allow you to use the original resource-pool. I didn't get =
around to writing instances for the latest version of monad-control =
though (I decided to switch back to `MonadCatchIO` instead). Here's the =
code I had for `MonadControlIO`:

    #if MIN_VERSION_monad_control(0,3,0)
 =09
    #else
    instance MonadControlIO (Handler b v) where
      liftControlIO f =3D liftBase (f return)
    #endif


Jurri=EBn

On 5 Feb 2012, at 11:46, Gregory Collins wrote:

> On Sun, Feb 5, 2012 at 10:45 AM, Dmitry Dzhus <d...@dzhus.org> wrote:
> How are you gentlemen?
>=20
> I'd like to switch to using Pool from resource-pool [1] package in my
> snaplet [2] to handle database connection pool. This requires my
> Handlers to have MonadBaseControl IO instance, whereas Snap provides
> MonadCatchIO. Seems like using resource-pool-catchio fork [3] could do
> the trick, but is there any chance to see MonadBaseControl support in
> Snap?
>=20
> [1]: http://hackage.haskell.org/package/resource-pool
> [2]: =
https://github.com/dzhus/snap-redis-crud/blob/master/src/RedisDB.hs
> [3]: http://hackage.haskell.org/package/resource-pool-catchio
>=20
> I think one of Jurri=EBn or Jasper was working on it, but it's =
actually not easy to do; there are little wrinkles in our MonadCatchIO =
instance which MonadBaseControl doesn't support. You're better off just =
lifting to IO and running your database code there.
>=20
> G
> --=20
> Gregory Collins <g...@gregorycollins.net>