-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Some progress towards fixing mdocs #70
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ Commands can be produced as part of a result of calling the `init` or `updateMod | |
|
||
Here is an example in which, on receiving a message `Msg.LogThis`, we are not going to change the model, but we want to write to the browser's JavaScript console: | ||
|
||
```scala mdoc:silent | ||
```scala mdoc:js:shared | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copying from Discord for posterity: That file only has Just changing one of the blocks from |
||
import tyrian.* | ||
import tyrian.cmds.* | ||
import cats.effect.IO | ||
|
@@ -56,7 +56,7 @@ def update(msg: Msg, model: Model): (Model, Cmd[IO, Msg]) = | |
|
||
To achieve this, we use the `Logger` command that comes with Tyrian. The `Logger` command is in fact just a `Cmd.SideEffect` that captures a value or behavior as a zero argument function, known as a `thunk`, in this case a simplified implementation could just be: | ||
|
||
```scala mdoc:silent | ||
```scala mdoc:js:compile-only | ||
def consoleLog(msg: String): Cmd[IO, Nothing] = | ||
Cmd.SideEffect { | ||
println(msg) | ||
|
@@ -65,13 +65,13 @@ def consoleLog(msg: String): Cmd[IO, Nothing] = | |
|
||
But commands can also return values in the form of messages. The `Random` command looks like this: | ||
|
||
```scala | ||
```scala mdoc:js:compile-only | ||
Random.double | ||
``` | ||
|
||
...and produces an instance of `RandomValue`, but this leads to a problem since `RandomValue` is almost certainly not your app's `Msg` type, and so we must map over the result: | ||
|
||
```scala | ||
```scala mdoc:js:compile-only | ||
enum MyMsg: | ||
case MyRandom(d: Double) extends MyMsg | ||
|
||
|
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.
I'd really like to switch this for
"io.indigoengine" %%% "tyrian" % tyrianDocsVersion
ideally, the current in dev version is the one I want the docs checked against. Feels like that should work but it threw up new problems for me.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.
Ah but I guess that won't work because they're all published against a later version of Scala.js.
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, I wouldn't take any of the changes in this PR too seriously :) mainly, it's to demonstrate that things should work and hopefully help track down that mdoc regression in the latest release.