Currently the database that this library interacts with is sqlite, and all operations run in IO.
I wonder if you would consider allowing the user to interact with a database of their choice? This would allow using databases other than sqlite, and it would also allow frontends (e.g. Miso/Reflex) to interact with a web server using GP.
This would mean instead of having operations like:
deleteById :: forall a id. (Entity a, Convertible id SqlValue) => Conn -> id -> IO ()
The operations would look like:
deleteById :: forall m a id. (MonadGP m, Entity a, Convertible id SqlValue) => Conn -> id -> m ()
Then, in order to ensure that existing library users aren't affected by the change:
instance MonadGP IO where
deleteById = -- existing sqlite IO
selectById = -- existing sqlite IO
In order to make it easier for those writing an instance of MonadGP the typeclass could be made more fine-grained, so you only have to write instance for the operations you want to use. Example:
class MonadGPDelete m where
deleteById :: --
class MonadGPSelect m where
selectById :: --
Currently the database that this library interacts with is sqlite, and all operations run in
IO.I wonder if you would consider allowing the user to interact with a database of their choice? This would allow using databases other than sqlite, and it would also allow frontends (e.g. Miso/Reflex) to interact with a web server using GP.
This would mean instead of having operations like:
The operations would look like:
Then, in order to ensure that existing library users aren't affected by the change:
In order to make it easier for those writing an instance of
MonadGPthe typeclass could be made more fine-grained, so you only have to write instance for the operations you want to use. Example: