-
Notifications
You must be signed in to change notification settings - Fork 3
Compatibility with hpqtypes 1.13.0.0 #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bcb857c to
db61ca6
Compare
Raveline
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally good to me. I got a bit sidetracked when reading because your withState is not at all behaving like the withState from mtl and I guess it's a bit confusing for people who are used to the mtl one, but since it's a purely internal function, it doesn't matter.
| { unDBEff :: Eff (State (DBState es) : es) a | ||
| } | ||
| deriving newtype (Functor, Applicative, Monad, MonadThrow, MonadCatch, MonadMask) | ||
| runDB cs0 ts0 m = PQ.withConnectionData cs0 ts0 $ \cd0 -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of do in this block that are not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, as I said before, this is for appeasing emacs indentation mode :p
| runDB | ||
| :: forall es a | ||
| . IOE :> es | ||
| :: IOE :> es |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come you can now remove the forall here now ? Or was it already unnecessary to begin with ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old runWithState and doWithTransaction from the where clause was using it before.
| GetLastQuery :: DB m SomeSQL | ||
| GetTransactionSettings :: DB m TransactionSettings | ||
| SetTransactionSettings :: TransactionSettings -> DB m () | ||
| GetLastQuery :: DB m (BackendPid, SomeSQL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you very often don't care about the first parameter (as illustrated in the change you made in tests), it might be interesting to add a helper getLastQuery' which basically fmap snd over getLastQuery. It's likely to be a very common use-case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite. getLastQuery is never used in regular code, it's pretty much a helper for throwDB to fill in details in the DBEXception wrapper.
a214a6a to
26eac22
Compare
Needs scrive/hpqtypes#80.