Skip to content

Commit

Permalink
Merge pull request #2993 from TimWSpence/docs-faq
Browse files Browse the repository at this point in the history
Add a FAQ section to the docs
  • Loading branch information
djspiewak authored May 20, 2022
2 parents 78a1e24 + 9aadc96 commit 1305575
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: faq
title: FAQ
---

## Scala CLI

[Scala CLI](https://scala-cli.virtuslab.org/) can run both `.sc` files and `.scala` files. `.sc` files allow definitions at the top level and a main method is synthesized to run it. Unfortunately this does not work well with `IO#unsafeRunSync`. You should put your cats-effect code inside the `run` method of an `IOApp` and save it as a `.scala` file instead.

```scala-cli
//> using scala "2.13.8"
//> using lib "org.typelevel::cats-effect::3.3.11"
import cats.effect._
object HelloWorld extends IOApp.Simple {
val run: IO[Unit] = IO.println("Hello world")
}
```

```sh
scala-cli Hello.scala
```
1 change: 1 addition & 0 deletions site-docs/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"getting-started",
"concepts",
"tutorial",
"faq",
"migration-guide"
],
"Core Runtime": [
Expand Down

0 comments on commit 1305575

Please sign in to comment.