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

More explicit types in examples #190

Merged
merged 4 commits into from
Feb 13, 2023
Merged

More explicit types in examples #190

merged 4 commits into from
Feb 13, 2023

Conversation

armanbilge
Copy link
Owner

And some other minor tidying.

Closes #189. @hejfelix were these the ones you were thinking, any others I should add to?

@hejfelix
Copy link

Yeah. I think adding them to all the *.md code would hammer home the point that components are Resource[F, HtmlElement[F]].

h1("Let's count!"),
Counter("Sheep", initialStep = 3)
)

app.renderInto(node.asInstanceOf[fs2.dom.Node[IO]]).allocated.unsafeRunAndForget()
app.renderInto(node.asInstanceOf[fs2.dom.Node[IO]]).useForever.unsafeRunAndForget()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This asInstanceOf looks a bit "hacky", at least for people not knowing background story. It also kind of leaks the opaque type. Maybe we can hide that somehow.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, the unsafeRunAndForget() also is not so great 😅 maybe we can move these out of the code block 🤔

@armanbilge armanbilge merged commit 33cac95 into main Feb 13, 2023
@armanbilge armanbilge deleted the pr/i189 branch February 13, 2023 17:16
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.

Add types to all methods in examples
3 participants