-
Notifications
You must be signed in to change notification settings - Fork 158
Add partial applicative typeclass functions #2545
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
cd095db
to
9158361
Compare
This makes sense to me. Can we also get Edit: What does bother me a little bit is that we use both |
The commit details for the first commit say:
Note the stray space between And a bit nitpicky, the commit summary goes over the 50-char limit of the 50/72 rule. I didn't count the characters, I noticed the GitHub website UI cut off the summary: 24d7979 [edit] [edit 2] |
Yes, though I feel the |
Yeah, I guess my comment wasn't really directed at this PR. I was merely pointing out the fact that |
I agree in principle, but the whole problem with these comic book swear words is that even if you think of a rigorous structure and apply it, it will always feel random without a full explanation of why |
We could just call them x `bitShiftInR` y |
e9f8f5a
to
d98ad49
Compare
We already have the `.foo.` pattern for these typeclasses. After this change, you can use `.foo bar` instead when `bar` is a constant.
d98ad49
to
433b2a7
Compare
433b2a7
to
3a2398c
Compare
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.
LGTM modulo missing exports and a CI breakage :)
@@ -241,9 +241,9 @@ module Clash.Signal | |||
, testFor | |||
-- * Type classes | |||
-- ** 'Eq'-like | |||
, (.==.), (./=.) | |||
, (.==.), (.==), (==.), (./=.), (./=), (/=.) |
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.
It's further up in this file, but the new functions amongst (.&&.), (&&.), (.&&), (.||.), (||.), (.||)
should also be imported.
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.
exported*
@@ -0,0 +1 @@ | |||
ADDED: Alongside the existing Eq-like and Ord-like signal operators like `.==.` and `.<=.` etc. There are now new functions for comparing with constants: `.==`, `==.`, `./=`, `/=.`, `.<=`, `<=.`, `.>=`, `>=.`, `.>`, `>.`, `.<`, `<.`, `.&&`, `&&.`, `.||`, `||.`. These are useful for comparing signals with constants in a more readable way. For example, `a .==. pure True` can now be replaced with `a .== True`. |
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.
ADDED: Alongside the existing Eq-like and Ord-like signal operators like `.==.` and `.<=.` etc. There are now new functions for comparing with constants: `.==`, `==.`, `./=`, `/=.`, `.<=`, `<=.`, `.>=`, `>=.`, `.>`, `>.`, `.<`, `<.`, `.&&`, `&&.`, `.||`, `||.`. These are useful for comparing signals with constants in a more readable way. For example, `a .==. pure True` can now be replaced with `a .== True`. | |
ADDED: Alongside the existing Eq-like and Ord-like signal operators like `.==.` and `.<=.` etc., there are now new functions for comparing with constants: `.==`, `==.`, `./=`, `/=.`, `.<=`, `<=.`, `.>=`, `>=.`, `.>`, `>.`, `.<`, `<.`, `.&&`, `&&.`, `.||`, `||.`. These are useful for comparing signals with constants in a more readable way. For example, `a .==. pure True` can now be replaced with `a .== True`. |
We currently have functions like
.==.
that can operate onSignal
s. However, I find myself often writing.foo. pure bar
when comparing signals to constants.With these changes(inspired by @gergoerdi's retrocomputing lib) we can write
.foo bar
instead.Still TODO: