Open MangoIV opened 1 year ago
Also what I don't quite understand is; if we disregard overlapping instances, we get exactly MonadIO
, right, because for any Monad m
we instantly discharge into MonadIO
, except if we specify a MonadResult
constraint on that m
MonadResult
is only needed to define safe Transaction
s. Otherwise you’re right, MonadIO
would suffice alone. Users should not write MonadResult
instances.
You can imagine that MonadResult
is a superclass of MonadIO
.
class MonadResult m => MonadIO m
It’s not possible to do that but the catchall instance mostly accomplishes the same thing.
instance MonadIO m => MonadResult m
perhaps I need to rephrase my issue here; currently, afaict, there's no way to escape from PQ but using IO; there's no way to actually interpret the SQL queries in any other way; what I want to do is interpret a subset of squeal queries in a pure way, there's no way of doing so currently, afaict, because of the MonadIO io => PQ ... io
and the getRows :: ... io ..
type signatures where the latter stems from the catchall instace of MonadResult
I see. I’m afraid I didn’t anticipate such a need as reinterpreting PQ
purely as libPQ is IO
bound.
Hi, currently the only instance for
MonadResult
is the catchall instance that then requires aMonadIO
; would it be a good idea to instead write proper instances for all the usual Monad transformers to be able to write interpretations that are not necessarily impure without using{-# OVERLAPPING #-}
pragmas on theMonadResult
instance?