Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Daniel-Diaz
Copy link

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.

@@ -267,6 +267,10 @@ class ToForm a where

instance ToForm Form where toForm = id

instance ToForm Void where toForm _ = Form HashMap.empty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absurd

Copy link
Author

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?

Daniel-Diaz@b7e4ce9

@@ -413,6 +417,8 @@ class FromForm a where

instance FromForm Form where fromForm = pure

instance FromForm () where fromForm _ = Right ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FromForm Void should fail.

Copy link
Author

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 ().

Copy link
Collaborator

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.

Copy link
Author

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?

Copy link
Author

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!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Daniel-Diaz
Copy link
Author

Any further feedback on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants