rightfold / purescript-postgresql-client

https://pursuit.purescript.org/packages/purescript-postgresql-client
BSD 3-Clause "New" or "Revised" License
35 stars 20 forks source link

Consider transforming `PG` monad stack into mtl style `class`. #36

Closed paluh closed 5 years ago

paluh commented 5 years ago

We can probably provide polymorphic version of PG instead of concrete stack - something like this should be sufficient:

class (MonadAff m, MonadError PGError m) <= MonadPG m
JordanMartinez commented 5 years ago

If we hard-code the e type to PGError, won't that limit other error types from being used in a computation? I'm not sure whether one would do such a thing, but I thought I'd bring it up.

paluh commented 5 years ago

If we hard-code the e type to PGError, won't that limit other error types from being used in a computation?

This base monad should be hoisted into an application stack using withExceptT. We are not able to avoid some form of hoisting I think if we want to provide some form of monad or class out of the box. The problem is that current model with hardcoded ExceptT seems to be hard to hoist in the real world scenarios.

paluh commented 5 years ago

https://github.com/rightfold/purescript-postgresql-client/pull/41