<div dir="ltr">Is this on Persistent 0.5 or 0.6?<br><br><div class="gmail_quote">On Wed, Aug 24, 2011 at 12:33 PM, Max Cantor <span dir="ltr"><<a href="mailto:mxcantor@gmail.com">mxcantor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I am trying to use an ErrorT monad inside some Persist code.<br>
<br>
I wrote the following instance:<br>
<br>
newtype OcrError = OE String<br>
...<br>
instance PersistBackend m => PersistBackend (ErrorT OcrError m) where<br>
replace k v = lift $ replace k v<br>
update k l = lift $ update k l<br>
updateWhere f u = lift $ updateWhere f u<br>
delete = lift . delete<br>
insert = lift . insert<br>
deleteBy = lift . deleteBy<br>
deleteWhere = lift . deleteWhere<br>
get = lift . get<br>
getBy = lift . getBy<br>
count = lift . count<br>
selectKeys f = selectKeys f<br>
selectEnum f o lim off = selectEnum f o lim off<br>
<br>
It seems like there is a problem with selectEnum though.<br>
<br>
In GHCI, this:<br>
<br>
l :: [PersistKV OcrRefMap] <- rs $ selectEnum [] [] 0 0<br>
<br>
works fine, while this:<br>
<br>
l :: Either OcrError [PersistKV OcrRefMap] <- rs $ runErrorT $ selectEnum [] [] 0 0<br>
<br>
hangs. rs is a small function to run persist calls:<br>
rs :: (MonadControlIO m) => SqlPersist m a -> m a<br>
rs f = do<br>
let conn = DT.pack "user=hachicode password=password host=localhost port=5432 dbname=hachicode"<br>
withPostgresqlConn conn $ runSqlConn f<br>
<br>
and you need -XScopedTypeVariables for the ghci commands.<br>
<br>
Any advice?<br>
<br>
Thanks,<br>
<font color="#888888">Max</font></blockquote></div><br></div>