Hi Michael, <div><br></div><div>i need to handle exception on GHandler monad level.</div><div><br></div><div>We have: </div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; "><i><span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: normal; ">type</span> <a name="t:GHandler" class="def" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; font-weight: bold; ">GHandler</a> sub master = <a href="http://hackage.haskell.org/packages/archive/yesod-core/0.8.1/doc/html/Yesod-Handler.html#t:GGHandler" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">GGHandler</a> sub master (<a href="http://hackage.haskell.org/packages/archive/enumerator/0.4.10/doc/html/Data-Enumerator.html#t:Iteratee" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">Iteratee</a> <a href="http://hackage.haskell.org/packages/archive/bytestring/0.9.1.10/doc/html/Data-ByteString.html#t:ByteString" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">ByteString</a> <a href="http://hackage.haskell.org/packages/archive/base/4.3.1.0/doc/html/System-IO.html#t:IO" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">IO</a></i></span><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; "><i>)</i></span></div>

<div><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="font-size: 14px; line-height: 16px;"><i><br clear="all"></i></span></font><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; "><span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: normal; ">data</span> <a name="t:GGHandler" class="def" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; font-weight: bold; ">GGHandler</a> </span><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; ">sub master m a</span></div>

<div><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="font-size: 14px; line-height: 16px;">     ...<br></span></font></div><div>            <span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><a href="http://hackage.haskell.org/packages/archive/monad-control/0.2.0.1/doc/html/Control-Monad-IO-Control.html#t:MonadControlIO" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">MonadControlIO</a> m =&gt; <a href="http://hackage.haskell.org/packages/archive/monad-control/0.2.0.1/doc/html/Control-Monad-IO-Control.html#t:MonadControlIO" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">MonadControlIO</a> (<a href="http://hackage.haskell.org/packages/archive/yesod-core/0.8.1/doc/html/Yesod-Handler.html#t:GGHandler" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">GGHandler</a> sub master m)</span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial; font-size: small; line-height: normal; white-space: normal; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; "><i>(<a href="http://hackage.haskell.org/packages/archive/enumerator/0.4.10/doc/html/Data-Enumerator.html#t:Iteratee" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">Iteratee</a> <a href="http://hackage.haskell.org/packages/archive/bytestring/0.9.1.10/doc/html/Data-ByteString.html#t:ByteString" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">ByteString</a> <a href="http://hackage.haskell.org/packages/archive/base/4.3.1.0/doc/html/System-IO.html#t:IO" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">IO</a></i></span><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; "><i>) have no instance of </i></span></span></span> <span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><a href="http://hackage.haskell.org/packages/archive/monad-control/0.2.0.1/doc/html/Control-Monad-IO-Control.html#t:MonadControlIO" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(196, 69, 29); ">MonadControlIO</a> thus we got error:</span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><div>No instance for (MonadControlIO</div>

<div>                       (Data.Enumerator.Iteratee Data.ByteString.Internal.ByteString IO))</div><div>      arising from a use of `E.catch&#39;</div><div>    Possible fix:</div><div>      add an instance declaration for</div>

<div>      (MonadControlIO</div><div>         (Data.Enumerator.Iteratee Data.ByteString.Internal.ByteString IO))</div></span></div><div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br>

</span></div><div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br>

</span></div><div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">i need something like:</span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i><br></i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>function :: Handler (Maybe Int)</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i><meta http-equiv="content-type" content="text/html; charset=utf-8">function = do </i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>            res &lt;- E.catch (runDB $ do </i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                            action1</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                            action2</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                            ... </i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                            return 1</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                   )</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><i>                   (\(e :: E.SomeException) -&gt; return 0)</i></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">How i can get this ?</span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br></span></div>

<div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">Thanks.</span></div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span" style="font-family: monospace; font-size: 14px; line-height: 16px; white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><br>

</span></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>-- <br>Best regards,<br>Cheshkov Anton <br>Phone: +7 909 005 18 82<br>Skype: cheshkov_anton<br>
</div>