-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixture generation for MultiParamTypeClasses #24
Comments
Yep, we should probably fix this. At the very least, we should give a better error message than just a pattern match failure. We haven’t had a use case for it on our end, so we never implemented it, but we should support it. I’ll look into what a fix would take. |
Thinking more about this, I’m not entirely sure what the “right” thing to do is here. What instance would you expect to be generated by that class (Monad m, MonadThrow m, FromJSON a) => MonadHTTPGet m a where
getWith :: Wreq.Options -> String -> m (Wreq.Response a)
data Fixture m a = Fixture
{ _getWith :: Wreq.Options -> String -> m (Wreq.Response a) }
instance (Monad m, MonadThrow m) => MonadHTTPGet (TestFixtureT Fixture w s m) ??? where What should the It seems like maybe you want to write the following single-parameter typeclass, instead: class (Monad m, MonadThrow m) => MonadHTTPGet m where
getWith :: FromJSON a => Wreq.Options -> String -> m (Wreq.Response a) Or is there something I’m missing? |
No, you're right... I went for the more complicated solution, but Thanks for improving the error message already! btw, I have stumbled upon another issue: among the constraints that I'm using there's MonadLog, which as you can see is using functional dependencies and has an existentially quantified argument in a input function. The end result is that I get this error:
I haven't yet pinned down what's the exact cause for this error (when I'll do it I'll open up a new issue), but maybe for you it's obvious what exactly is going wrong here (I think that in the meanwhile I'll just wrap Thanks again! |
Feel free to open an issue if you have a self-contained test case for the |
Hi, I have a multiparam type class like this:
(I was hoping to use it, to avoid having to return
m (Wreq.Response ByteString)
which would force me to define an otherwise not-needed ToJSON instance fora
, andencode
the test values that my test code would yield when implementinggetWith
... not sure if there's a better alternative)But when using
mkFixture
I get the following error:Would it make sense for this to be implemented?
The text was updated successfully, but these errors were encountered: