-
Notifications
You must be signed in to change notification settings - Fork 9
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 HtmlTag#withSelf
, restore debounce example
#155
Conversation
docs/time.md
Outdated
input { self => | ||
input { (self: fs2.dom.HtmlInputElement[IO]) => // FIXME compiler bug | ||
onInput --> (_.evalMap(_ => self.value.get).through(emailCh.sendAll)) |
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.
This is extremely annoying. Another workaround is to do:
input { self =>
Tuple1(onInput --> (_.evalMap(_ => self.value.get).through(emailCh.sendAll)))
}
I'm going to try and minimize and report a compiler bug.
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 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.
Seems like there's still work to do in regards to implementing overloads soundly, even in Scala 3. To this day, I've always avoided them without missing too much.
Yes, that is often good practice. Do you think we should do that here? We can add it as an alternative API e.g. input.withSelf { self =>
onInput --> (_.evalMap(_ => self.value.get).through(emailCh.sendAll))
} I think Laminar might call it |
I'd absolutely prefer that, yes. These types of bugs are super annoying, especially for non expert Scala users. In my experience it's best to even disable all nasty features that can be somehow disabled. At work, we use the strictest scalac 2 settings together with nearly all of https://www.wartremover.org/, and everyone is super happy with that. Furthermore, we still avoid Scala 3 there, because there are a bunch of strict flags not implemented (yet?). |
Ah and |
Great, I'll add that!
Good news, many new strict flags are arriving in Scala 3.3.0 :) |
HtmlTag#withSelf
, restore debounce example
def apply[M](mkModifier: E => M)(using M: Modifier[F, E, M]): Resource[F, E] = | ||
def withSelf[M](mkModifier: E => M)(using M: Modifier[F, E, M]): Resource[F, E] = |
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 to second guess 😅 maybe another option is fromSelf
. But withSelf
is good. I think 😅
input { (self: fs2.dom.HtmlInputElement[IO]) => // FIXME compiler bug | ||
input.withSelf { self => |
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, overloads are bad 😓
Yeah, seems like what I was trying to do here was an unsupported behavior according to scala/scala3#16737 (comment) 😅 |
Closes #132.