-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add trivial instances for () and Void #148
base: master
Are you sure you want to change the base?
Conversation
src/Web/Internal/FormUrlEncoded.hs
Outdated
@@ -267,6 +267,10 @@ class ToForm a where | |||
|
|||
instance ToForm Form where toForm = id | |||
|
|||
instance ToForm Void where toForm _ = Form HashMap.empty |
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.
absurd
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.
You are right. Like this?
@@ -413,6 +417,8 @@ class FromForm a where | |||
|
|||
instance FromForm Form where fromForm = pure | |||
|
|||
instance FromForm () where fromForm _ = Right () |
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.
FromForm Void should fail.
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.
There is no Void
here, this is ()
.
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.
There should be void too.
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.
Perhaps you meant to add an instance for Void
that fails?
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.
Oh, I wrote the comment before I saw yours. On it!
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.
Done in: Daniel-Diaz@14a5f53
Any further feedback on this? |
These are useful when a function expects a form but no form is to be passed.
I updated the stack file because it otherwise didn't build.