Skip to content

Instantly share code, notes, and snippets.

@witt3rd
Last active April 18, 2021 14:08
Show Gist options
  • Select an option

  • Save witt3rd/e0aa245bcce6c2f0e4a16d4a504e6fa9 to your computer and use it in GitHub Desktop.

Select an option

Save witt3rd/e0aa245bcce6c2f0e4a16d4a504e6fa9 to your computer and use it in GitHub Desktop.

Revisions

  1. witt3rd revised this gist Apr 18, 2021. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -65,16 +65,18 @@ sbt compile
    sbt run
    ```

    ## Code Formatting
    ## SBT Plugins

    The following plugins can be added to `project/plugins.sbt` to enhance the Scala coding experience.

    ### Code Formatting

    - [Scalafmt](https://scalameta.org/scalafmt/)

    ```bash
    cs install scalafmt
    ```

    Add the following to `project/plugins.sbt`:

    ```scala
    addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") // "2.4.0" is just sbt plugin version
    ```
    @@ -87,6 +89,16 @@ align.preset = more
    maxColumn = 100
    ```

    ### better-monadic-for

    | A Scala compiler plugin to give patterns and for-comprehensions the love they deserve.

    - [better-monadic-for](https://github.com/oleg-py/better-monadic-for)

    ```scala
    addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
    ```

    ## IDEs

    #### VS Code
  2. witt3rd revised this gist Apr 18, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -127,6 +127,7 @@ bloop run -w <project>

    - [ZIO](https://github.com/zio/zio)
    - [A Tour of ZIO](https://youtu.be/TWdC7DhvD8M)
    - [Scala 3 version](https://github.com/witt3rd/zio-tour)
    - [Getting started with ZIO](https://youtu.be/6A1SA5Be9qw)
    - [Functional Programming 101 with Scala and ZIO - Functional World #3](https://youtu.be/gZMwjYTkK9k)
    - [Prelude](https://github.com/zio/zio-prelude)
  3. witt3rd revised this gist Apr 17, 2021. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,28 @@ sbt compile
    sbt run
    ```

    ## Code Formatting

    - [Scalafmt](https://scalameta.org/scalafmt/)

    ```bash
    cs install scalafmt
    ```

    Add the following to `project/plugins.sbt`:

    ```scala
    addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") // "2.4.0" is just sbt plugin version
    ```

    Metals should automatically create a `.scalafmt.conf` file in the project root. My settings:

    ```text
    version = "2.7.4"
    align.preset = more
    maxColumn = 100
    ```

    ## IDEs

    #### VS Code
  4. witt3rd revised this gist Apr 16, 2021. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -88,7 +88,10 @@ From another terminal (same directory), run:
    bloop run -w <project>
    ```

    - [Scala 3 Giter8 template](https://github.com/witt3rd/zio-dotty-quickstart.g8)
    ## Project Scaffolds

    - [Scala 3 Giter8 Template](https://github.com/witt3rd/zio-dotty-quickstart.g8)
    - [Scala 3 ZIO Starter](https://github.com/witt3rd/zio-starter)

    ## Language

    @@ -107,6 +110,8 @@ bloop run -w <project>
    - [Prelude](https://github.com/zio/zio-prelude)
    - [SF Scala: Reimagining Functional Type Classes](https://youtu.be/OwmHgL9F_9Q)
    - [CLI](https://github.com/zio/zio-cli)
    - [Query](https://github.com/zio/zio-query)
    - [Schema](https://github.com/zio/zio-schema)

    ### Misc

  5. witt3rd revised this gist Apr 16, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -101,6 +101,9 @@ bloop run -w <project>
    ### ZIO

    - [ZIO](https://github.com/zio/zio)
    - [A Tour of ZIO](https://youtu.be/TWdC7DhvD8M)
    - [Getting started with ZIO](https://youtu.be/6A1SA5Be9qw)
    - [Functional Programming 101 with Scala and ZIO - Functional World #3](https://youtu.be/gZMwjYTkK9k)
    - [Prelude](https://github.com/zio/zio-prelude)
    - [SF Scala: Reimagining Functional Type Classes](https://youtu.be/OwmHgL9F_9Q)
    - [CLI](https://github.com/zio/zio-cli)
  6. witt3rd revised this gist Apr 16, 2021. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -32,9 +32,7 @@ sdk i java 11.0.10.9.1-amzn

    #### sbt



    - (sbt)[https://www.scala-sbt.org/index.html]
    - [sbt](https://www.scala-sbt.org/index.html)

    ```bash
    sdk i sbt 1.5.0
    @@ -44,7 +42,7 @@ sdk i sbt 1.5.0

    A system-wide build server that speeds compile times and can watch for changes and automatically recompile.

    - (Bloop)[https://scalacenter.github.io/bloop/]
    - [Bloop](https://scalacenter.github.io/bloop/)

    ```bash
    cs install bloop --only-prebuilt=true
  7. witt3rd revised this gist Apr 16, 2021. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -90,16 +90,23 @@ From another terminal (same directory), run:
    bloop run -w <project>
    ```

    - [Scala 3 Giter8 template](https://github.com/witt3rd/zio-dotty-quickstart.g8)

    ## Language

    - [Dean Wampler](https://deanwampler.github.io/scala3-highlights.html)
    - [Scala 3 Highlights (Dean Wampler)](https://deanwampler.github.io/scala3-highlights.html)
    - [Rock the JVM](https://rockthejvm.com/)

    - [Paolo Giarrusso—The DOT Calculus: An Introduction for Scala Programmers](https://www.youtube.com/watch?v=OVu7XzHY5U0)

    ## Ecosystem

    ### ZIO

    - [Scala 3 Giter8 template](https://github.com/witt3rd/zio-dotty-quickstart.g8)
    - [ZIO](https://github.com/zio/zio)
    - [Prelude](https://github.com/zio/zio-prelude)
    - [SF Scala: Reimagining Functional Type Classes](https://youtu.be/OwmHgL9F_9Q)
    - [CLI](https://github.com/zio/zio-cli)

    ### Misc

    - [Scale By The Bay 2020: Juan Pablo Romero, A tour of String diagrams and Monoidal categories](https://youtu.be/CSFEzAgNJFM)
  8. witt3rd revised this gist Apr 13, 2021. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -92,7 +92,7 @@ bloop run -w <project>

    ## Language

    - [Scala 101](https://www.baeldung.com/scala-intro)
    - [Dean Wampler](https://deanwampler.github.io/scala3-highlights.html)
    - [Rock the JVM](https://rockthejvm.com/)


    @@ -101,4 +101,5 @@ bloop run -w <project>
    ### ZIO

    - [Scala 3 Giter8 template](https://github.com/witt3rd/zio-dotty-quickstart.g8)

    - [Prelude](https://github.com/zio/zio-prelude)
    - [CLI](https://github.com/zio/zio-cli)
  9. witt3rd revised this gist Apr 12, 2021. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -92,4 +92,13 @@ bloop run -w <project>

    ## Language

    - [Scala Intro](https://www.baeldung.com/scala-intro)
    - [Scala 101](https://www.baeldung.com/scala-intro)
    - [Rock the JVM](https://rockthejvm.com/)


    ## Ecosystem

    ### ZIO

    - [Scala 3 Giter8 template](https://github.com/witt3rd/zio-dotty-quickstart.g8)

  10. witt3rd revised this gist Apr 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ This extension will install everything it needs

    ## Watch, Compile, and Run

    Use Bloop to watch for changes and automatically compile and run your program. Your project should have a `.bloop` directory that contains a `<project>.json`, `<project-test>.json`, and a `<project>` subdirectory. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use `bloop project` to create one.
    Use Bloop to watch for changes and automatically compile and run your program. Your project should have a `.bloop` directory that contains a `<project>.json`, `<project>-test.json`, and a `<project>` subdirectory. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use `bloop project` to create one.

    In one terminal session from within your project's root directory (the one that contains `.bloop`), run:

  11. witt3rd revised this gist Apr 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ This extension will install everything it needs

    ## Watch, Compile, and Run

    Use Bloop to watch for changes and automatically compile and run your program. Your project should have a `.bloop` directory that contains a <project>.json, <project-test>.json, and a <project> folder. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use `bloop project` to create one.
    Use Bloop to watch for changes and automatically compile and run your program. Your project should have a `.bloop` directory that contains a `<project>.json`, `<project-test>.json`, and a `<project>` subdirectory. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use `bloop project` to create one.

    In one terminal session from within your project's root directory (the one that contains `.bloop`), run:

  12. witt3rd revised this gist Apr 8, 2021. 1 changed file with 69 additions and 3 deletions.
    72 changes: 69 additions & 3 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -2,28 +2,94 @@

    ## Install

    ### Installers

    These CLI utilities are used to fetch things we need.

    - [SDKMan](https://sdkman.io/)
    - [Coursier](https://get-coursier.io/)

    ### Java

    We need a JDK, which SDKMAN is used for.

    ```bash
    # List available JDKs
    sdk ls java
    ```

    Amazon seems to have a high-quality one.

    - [Amazon Coretto](https://aws.amazon.com/corretto/)

    Version 11 is the last LTS version.

    ```bash
    sdk install java 11.0.10.9.1-amzn
    sdk i java 11.0.10.9.1-amzn
    ```

    ### Metals
    ### Build

    - [Metals](https://scalameta.org/metals/)
    #### sbt



    - (sbt)[https://www.scala-sbt.org/index.html]

    ```bash
    sdk i sbt 1.5.0
    ```

    #### Bloop

    A system-wide build server that speeds compile times and can watch for changes and automatically recompile.

    - (Bloop)[https://scalacenter.github.io/bloop/]

    ```bash
    cs install bloop --only-prebuilt=true
    ```

    ## New Project

    Create a new Scala 3 project using the following template:

    - [scala3.g8](https://github.com/scala/scala3.g8)

    ```bash
    sbt new scala/scala3.g8
    ```

    Change into your project directory and compile and run it using sbt.

    ```bash
    sbt compile
    sbt run
    ```

    ## IDEs

    #### VS Code

    This extension will install everything it needs
    - [Metals](https://scalameta.org/metals/)

    ## Watch, Compile, and Run

    Use Bloop to watch for changes and automatically compile and run your program. Your project should have a `.bloop` directory that contains a <project>.json, <project-test>.json, and a <project> folder. (Metals in VS Code will create this automatically.) If it doesn't exist, you'll need to use `bloop project` to create one.

    In one terminal session from within your project's root directory (the one that contains `.bloop`), run:

    ```bash
    bloop compile -w <project>
    ```

    From another terminal (same directory), run:

    ```bash
    bloop run -w <project>
    ```

    ## Language

    - [Scala Intro](https://www.baeldung.com/scala-intro)
  13. witt3rd revised this gist Apr 7, 2021. 1 changed file with 5 additions and 8 deletions.
    13 changes: 5 additions & 8 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -2,31 +2,28 @@

    ## Install

    [SDKMan](https://sdkman.io/)
    - [SDKMan](https://sdkman.io/)

    ### Java

    ```bash
    sdk ls java
    ```

    [Amazon Coretto](https://aws.amazon.com/corretto/)
    - [Amazon Coretto](https://aws.amazon.com/corretto/)

    ```bash
    sdk install java 11.0.10.9.1-amzn
    ```

    ### Metals

    [Metals](https://scalameta.org/metals/)

    - [Metals](https://scalameta.org/metals/)

    ## New Project

    [scala3.g8](https://github.com/scala/scala3.g8)
    - [scala3.g8](https://github.com/scala/scala3.g8)

    ## Language

    ### `def`, `var`, `val`, `lazy val`

    [Def, Var & Val in Scala](https://www.baeldung.com/scala/def-var-val)
    - [Scala Intro](https://www.baeldung.com/scala-intro)
  14. witt3rd revised this gist Apr 7, 2021. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    [SDKMan](https://sdkman.io/)

    ### Java

    ```bash
    sdk ls java
    ```
    @@ -22,4 +23,10 @@ sdk install java 11.0.10.9.1-amzn

    ## New Project

    [scala3.g8](https://github.com/scala/scala3.g8)
    [scala3.g8](https://github.com/scala/scala3.g8)

    ## Language

    ### `def`, `var`, `val`, `lazy val`

    [Def, Var & Val in Scala](https://www.baeldung.com/scala/def-var-val)
  15. witt3rd revised this gist Apr 7, 2021. 1 changed file with 4 additions and 28 deletions.
    32 changes: 4 additions & 28 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -15,35 +15,11 @@ sdk ls java
    sdk install java 11.0.10.9.1-amzn
    ```

    ### Coursier

    > coursier is a dependency resolver / fetcher à la Maven / Ivy, entirely rewritten from scratch in Scala. It aims at being fast and easy to embed in other contexts. Its core embraces functional programming principles. It handles many features of the Maven model, and is able to fetch metadata and artifacts from both Maven and Ivy repositories. It handles parallel downloads out-of-the-box without resorting to global locks.

    [Coursier](https://get-coursier.io/)

    ```bash
    brew install coursier/formulas/coursier
    cs setup
    ```

    ### Scala 3
    ```bash
    cs install scala3-compiler
    cs install scala3-repl
    ```

    ### Bloop

    [Bloop](https://scalacenter.github.io/bloop/)

    ```bash
    cs install bloop --only-prebuilt=true
    ```

    ### Metals

    [Metals](https://scalameta.org/metals/)

    ## Creating a new Scala 3 project
    [Alvin Alexander - How to create a Scala 3 project with SBT](https://alvinalexander.com/source-code/how-create-scala-3-dotty-project-sbt-commands/)

    ## New Project

    [scala3.g8](https://github.com/scala/scala3.g8)
  16. witt3rd revised this gist Apr 7, 2021. 1 changed file with 8 additions and 16 deletions.
    24 changes: 8 additions & 16 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -15,21 +15,6 @@ sdk ls java
    sdk install java 11.0.10.9.1-amzn
    ```

    ### SBT
    ```
    sdk install sbt
    ```

    ### Maven
    ```
    sdk install maven
    ```

    ### Scala 3
    ```bash
    sdk install scala 3.0.0-RC1
    ```

    ### Coursier

    > coursier is a dependency resolver / fetcher à la Maven / Ivy, entirely rewritten from scratch in Scala. It aims at being fast and easy to embed in other contexts. Its core embraces functional programming principles. It handles many features of the Maven model, and is able to fetch metadata and artifacts from both Maven and Ivy repositories. It handles parallel downloads out-of-the-box without resorting to global locks.
    @@ -39,14 +24,21 @@ sdk install scala 3.0.0-RC1

    ```bash
    brew install coursier/formulas/coursier
    cs setup
    ```

    ### Scala 3
    ```bash
    cs install scala3-compiler
    cs install scala3-repl
    ```

    ### Bloop

    [Bloop](https://scalacenter.github.io/bloop/)

    ```bash
    coursier install bloop --only-prebuilt=true
    cs install bloop --only-prebuilt=true
    ```

    ### Metals
  17. witt3rd revised this gist Apr 7, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -53,3 +53,5 @@ coursier install bloop --only-prebuilt=true

    [Metals](https://scalameta.org/metals/)

    ## Creating a new Scala 3 project
    [Alvin Alexander - How to create a Scala 3 project with SBT](https://alvinalexander.com/source-code/how-create-scala-3-dotty-project-sbt-commands/)
  18. witt3rd revised this gist Apr 7, 2021. 1 changed file with 30 additions and 1 deletion.
    31 changes: 30 additions & 1 deletion scala.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,36 @@ sdk install java 11.0.10.9.1-amzn
    sdk install sbt
    ```

    ### Maven
    ```
    sdk install maven
    ```

    ### Scala 3
    ```bash
    sdk install scala 3.0.0-RC1
    ```
    ```

    ### Coursier

    > coursier is a dependency resolver / fetcher à la Maven / Ivy, entirely rewritten from scratch in Scala. It aims at being fast and easy to embed in other contexts. Its core embraces functional programming principles. It handles many features of the Maven model, and is able to fetch metadata and artifacts from both Maven and Ivy repositories. It handles parallel downloads out-of-the-box without resorting to global locks.

    [Coursier](https://get-coursier.io/)

    ```bash
    brew install coursier/formulas/coursier
    ```

    ### Bloop

    [Bloop](https://scalacenter.github.io/bloop/)

    ```bash
    coursier install bloop --only-prebuilt=true
    ```

    ### Metals

    [Metals](https://scalameta.org/metals/)

  19. witt3rd created this gist Apr 7, 2021.
    26 changes: 26 additions & 0 deletions scala.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    # Scala

    ## Install

    [SDKMan](https://sdkman.io/)

    ### Java
    ```bash
    sdk ls java
    ```

    [Amazon Coretto](https://aws.amazon.com/corretto/)

    ```bash
    sdk install java 11.0.10.9.1-amzn
    ```

    ### SBT
    ```
    sdk install sbt
    ```

    ### Scala 3
    ```bash
    sdk install scala 3.0.0-RC1
    ```