eed3si9n https://eed3si9n.com/ Recent content on eed3si9n Hugo en Sun, 08 Dec 2024 00:00:00 +0000 december adventure 2024 https://eed3si9n.com/december-adventure-2024/ Sun, 08 Dec 2024 00:00:00 +0000 https://eed3si9n.com/december-adventure-2024/ <p>I&rsquo;m going to try to work on something small everyday during december. see the original <a href="https://eli.li/december-adventure">December Adventure</a>.</p> <p>my goal: work on sbt 2.x, other open source like sbt 1.x and plugins, or some post on this site, like music or recipe.</p> <p><a id="10"></a></p> <h3 id="2024-12-10">2024-12-10</h3> <h4 id="bumping-to-scala-362-and-improving-the-compiler">bumping to Scala 3.6.2, and improving the compiler</h4> <p>since <a href="https://www.scala-lang.org/news/3.6.2">Scala 3.6.2</a> seems to have been released, I sent a PR to update sbt 2.x to Scala 3.6.2 in <a href="https://github.com/sbt/sbt/pull/7941">#7941</a>.</p> low-rank adaptation (2024.12 mixtape) https://eed3si9n.com/2024.12-mixtape Mon, 02 Dec 2024 00:00:00 +0000 https://eed3si9n.com/2024.12-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/2B7odThvVf4dGbbkPYQlhy?utm_source=generator&theme=0" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> <ul> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUNi6UOcePVi8dTC32yX0KJ">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUNi6UOcePVi8dTC32yX0KJ</a></li> </ul> <!-- more --> sbt 1.10.6 https://eed3si9n.com/sbt-1.10.6 Sat, 30 Nov 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.6 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.6 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.6">https://github.com/sbt/sbt/releases/tag/v1.10.6</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates to Coursier 2.1.19 via lm-coursier 2.1.6</li> <li>Fix to Ctrl-C (cancelling)</li> </ul> sbt-projectmatrix 0.10.1 https://eed3si9n.com/sbt-projectmatrix-0.10.1 Sun, 24 Nov 2024 00:00:00 +0000 https://eed3si9n.com/sbt-projectmatrix-0.10.1 <p>I&rsquo;ve released sbt-projectmatrix 0.10.1. Full release note is <a href="https://github.com/sbt/sbt-projectmatrix/releases/tag/v0.10.1">https://github.com/sbt/sbt-projectmatrix/releases/tag/v0.10.1</a>.</p> intro to Hedgehog for Scala https://eed3si9n.com/hedgehog-scala/ Mon, 18 Nov 2024 00:00:00 +0000 https://eed3si9n.com/hedgehog-scala/ <p>In this post, I want to talk about <a href="https://hedgehogqa.github.io/scala-hedgehog/">Hedgehog for Scala</a>, a property-based testing framework created by Charles O&rsquo;Farrell around 2018, and has been maintained by Kevin Lee more recently, based on Haskell Hedgehog, which was cofounded by Jacob Stanley and Nikos Baxevanis.</p> sbt 1.10.5 https://eed3si9n.com/sbt-1.10.5 Sun, 03 Nov 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.5 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.5 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.5">https://github.com/sbt/sbt/releases/tag/v1.10.5</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates to Coursier 2.1.14 via lm-coursier 2.1.5</li> <li>Fixes to sbtn</li> </ul> sbt 1.10.4 https://eed3si9n.com/sbt-1.10.4 Mon, 28 Oct 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.4 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.4 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.4">https://github.com/sbt/sbt/releases/tag/v1.10.4</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> <p>sbt 1.10.4 contains mostly minor bug fixes.</p> tag-based back publishing with sbt https://eed3si9n.com/tag-based-back-publishing-with-sbt/ Mon, 21 Oct 2024 00:00:00 +0000 https://eed3si9n.com/tag-based-back-publishing-with-sbt/ <p>sbt-ci-release 1.9.0 is released, implementing tag-based back publishing support.</p> sbt 1.10.3 https://eed3si9n.com/sbt-1.10.3 Sat, 19 Oct 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.3 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.3 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.3">https://github.com/sbt/sbt/releases/tag/v1.10.3</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li><a href="https://github.com/advisories/GHSA-735f-pc8j-v9w8">CVE-2024-7254</a>. sbt 1.10.3 updates protobuf-java library to 3.25.5 to address reported potential Denial of Service</li> <li>Updates metabuild Scala version to 2.12.20</li> <li>Fixes for the spurious &ldquo;illegal reflective access operation&rdquo; error on JDK 11</li> <li>Reverting the invalidation of circular-dependent sources</li> </ul> Scala 3 Manifesto 0.1.0 https://eed3si9n.com/manifesto/ Mon, 14 Oct 2024 00:00:00 +0000 https://eed3si9n.com/manifesto/ <p>Over the weekend, I created Scala 3 Manifesto 0.1.0, a small library to re-implement <code>scala.reflect.Manifest</code> in Scala 3.</p> <p>Programming languages operate at two levels. First, the material level where bits and bytes are moved to take actions. Second, there is a higher, spiritual level that describes the material level. The first level is the runtime. The second level is the compile-time. Scala programs are written using <code>val</code> terms that are typed, but at the JVM bytecode, JS, or Native, the variables turn into something different, often more general. For example, a variable typed to <code>List[Int]</code> becomes <code>List[AnyRef]</code> at runtime.</p> sbt-assembly 2.3.0, Contraband 0.6.0, and sbt-pgp 2.3.0 https://eed3si9n.com/sbt-assembly-2.3.0 Sun, 06 Oct 2024 00:00:00 +0000 https://eed3si9n.com/sbt-assembly-2.3.0 <p>sbt-assembly 2.3.0, Contraband 0.6.0, and sbt-pgp 2.3.0 are released. Those plugins are cross published to Maven Central for sbt 1.x and sbt 2.0.0-M2, which came out two days ago. Many thanks to Kenji Yoshida (<a href="https://github.com/xuwei-k">@xuwei-k</a>) for many pull requests he&rsquo;s been sending.</p> sbt 2.0.0-M2 https://eed3si9n.com/sbt-2.0.0-beta Fri, 04 Oct 2024 00:00:00 +0000 https://eed3si9n.com/sbt-2.0.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 2.0.0-M2, a beta version of sbt 2.x. Please try it out, and report any issues you might come across. Note that sbt 2.x is released under Semantic Versioning, and the plugins will need to be published for the specific milestone version.</p> <p>I work on sbt in my own time with collaboration with <a href="https://www.linkedin.com/in/adrien-piquerez-22b478177/">Adrien Piquerez</a> at Scala Center and other volunteers, like Kenji Yoshida, Jerry Tan, Matthias Kurz (Play maintainer), and recently Billy at EngFlow to name a few.</p> sudori part 6: sbt query https://eed3si9n.com/sudori-part6/ Thu, 26 Sep 2024 00:00:00 +0000 https://eed3si9n.com/sudori-part6/ <p>This is a blog post on sbt 2.x development, continuing from <a href="https://eed3si9n.com/sbt-remote-cache">sbt 2.x remote cache</a>, <a href="https://eed3si9n.com/sbt-remote-cache-with-bazel-compat">sbt 2.x remote cache with Bazel compatibility</a>, <a href="https://eed3si9n.com/sudori-part4">sudori part 4</a>, <a href="https://eed3si9n.com/sudori-part5">part 5</a> etc. I work on sbt 2.x in my own time with collaboration with the Scala Center and other volunteers, like Billy at EngFlow.</p> <h2 id="sbt-query">sbt query</h2> <p>In <a href="https://eed3si9n.com/sbt-2.0-ideas">sbt 2.0 ideas</a> I mentioned:</p> <blockquote> <p>See <a href="https://github.com/sbt/sbt/discussions/6801">sbt query</a>. Query would be used to filter down the subprojects:</p> sbt 1.10.2 https://eed3si9n.com/sbt-1.10.2 Sun, 15 Sep 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.2 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.2">https://github.com/sbt/sbt/releases/tag/v1.10.2</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> RFC-4: persistent worker https://eed3si9n.com/rfc-4-persistent-worker/ Tue, 10 Sep 2024 00:00:00 +0000 https://eed3si9n.com/rfc-4-persistent-worker/ <ul> <li>Author: Eugene Yokota</li> <li>Date: 2024-09-10</li> <li>Status: <strong>Review</strong></li> </ul> <p>See <a href="https://eed3si9n.com/sbt-2.0-rfc-process">RFC-2</a> for the process. In <a href="https://eed3si9n.com/sbt-2.0-ideas">sbt 2.0 ideas</a> I wrote:</p> <blockquote> <p><strong>idea 5: BSP support + persistent workers</strong></p> <p>To preventing blocking the sbt server, we should consider shipping off long-running tasks to persistent workers, similar to today’s <code>fork</code> or <code>bgRun</code>. The candidate tasks are <code>run</code>, <code>test</code>, and <code>console</code>, but <code>compile</code> could be one too.</p> </blockquote> <p>I mostly had Bazel&rsquo;s <a href="https://bazel.build/remote/creating">persistent worker specification</a> in my mind.</p> sudori part 5 https://eed3si9n.com/sudori-part5/ Sun, 08 Sep 2024 00:00:00 +0000 https://eed3si9n.com/sudori-part5/ <p>This is a blog post on sbt 2.x development, continuing from <a href="https://eed3si9n.com/sudori-part3">part 3</a>, <a href="https://eed3si9n.com/sbt-remote-cache">sbt 2.x remote cache</a>, <a href="https://eed3si9n.com/sbt-remote-cache-with-bazel-compat">sbt 2.x remote cache with Bazel compatibility</a>, <a href="https://eed3si9n.com/sudori-part4">sudori part 4</a> etc. I work on sbt 2.x in my own time with collaboration with the Scala Center and other volunteers, like Billy at EngFlow. These posts are extended PR descriptions to share the features that will come to a future version of sbt.</p> <h3 id="introduction">introduction</h3> <p>I was on a late summer vacation in a beach town in Connecticut this week — checking out local skate spots, dipping into cool Long Island Sound, and comparing lobster rolls. In between skateboarding and beach going, I worked on remote test caching in sbt, and a few experiments related to the idea. I&rsquo;d like to share some of my findings here, mostly as a development write-up.</p> <p>In <a href="https://eed3si9n.com/sudori-part4">sudori part 4</a> we looked into remote caching of <code>compile</code> task. While caching <code>compile</code> is useful, most of the CI (continuous integration) systems spend their time running tests, not just compiling code. Bazel achieves orders-of-magnitude faster CI in part due the default <code>test</code> command being remote cached. In other words, using Bazel, if a test runs once on a CI machine, the test result will be cached until its input changes.</p> <p>An advanced sbt user might note that sbt already includes the <code>testQuick</code> task for local incremental testing. The issue with <code>testQuick</code> is that its invalidation relies on timestamps, which are non-hermetic, and thus not reproducible across machines. In this post, we&rsquo;ll discuss test caching for sbt 2.x that can be shared safely across the machines. The corresponding pull request is <a href="https://github.com/sbt/sbt/pull/7644">sbt/sbt#7644</a>.</p> ollie https://eed3si9n.com/ollie/ Tue, 03 Sep 2024 00:00:00 +0000 https://eed3si9n.com/ollie/ <p>I&rsquo;m a permanently beginner-level staker, who cannot ollie, but I&rsquo;ve been thinking about ollie, and here&rsquo;s a memo to collect various ideas.</p> <h3 id="mark-sucius-ollie-from-2014">Mark Suciu&rsquo;s ollie from 2014</h3> <p>It would be good to have a reference ollie. Here&rsquo;s Mark Suciu from ten years go:</p> <iframe width="560" height="315" src="https://www.youtube.com/embed/pXPuDHfNZPo?si=LN-QRiAPxr0Eoje3&amp;clip=Ugkx1rd9X4AtL1yE4sVuUCGIM5tnmCdFKMKE&amp;clipt=EMn3AhiNjAU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> <p>It&rsquo;s not easy to find a plain ollie in a part, but this one captures one from the side angle. The whole thing takes place in the first 3s of the clip, and the actual Ollie probably in a second.</p> sudori part 4 https://eed3si9n.com/sudori-part4/ Sun, 18 Aug 2024 00:00:00 +0000 https://eed3si9n.com/sudori-part4/ <p>This is a blog post on sbt 2.x development, continuing from <a href="https://eed3si9n.com/sudori-part3">sudori part3</a>, <a href="https://eed3si9n.com/sbt-remote-cache">sbt 2.x remote cache</a>, and <a href="https://eed3si9n.com/sbt-remote-cache-with-bazel-compat">sbt 2.x remote cache with Bazel compatibility</a>. I work on sbt 2.x in my own time with collaboration with the Scala Center. These posts are extended PR descriptions to share the features that will come to the future version of sbt, hopefully.</p> <h3 id="august-2024-status-quo">August 2024 status quo</h3> <p>Since April, 2024, we have had Bazel-compatible remote cache capability. The implementation currently supports file output as a cached side effect. In other words, even if we start from a fresh machine, if the remote cache is hydrated, we can download JAR files from the cache instead of running the compiler.</p> tree-sitter-scala 0.22.1 https://eed3si9n.com/tree-sitter-scala-0.22.1 Thu, 08 Aug 2024 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.22.1 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.22.1. The first two segments of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number. tree-sitter-scala 0.22.0 uses tree-sitter 0.22.x.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors). We publish Rust binding to <a href="https://crates.io/crates/tree-sitter-scala">crates.io</a>.</p> ifdef 0.3.0: conditional compilation in Scala https://eed3si9n.com/ifdef-0.3.0-conditional-compilation-in-scala Sat, 20 Jul 2024 00:00:00 +0000 https://eed3si9n.com/ifdef-0.3.0-conditional-compilation-in-scala <p><code>@ifdef</code> is a Scala compiler plugin that impelements conditional compilation in Scala. ifdef 0.3.0 supports Scala.JS and Scala Native.</p> <table> <thead> <tr> <th style="text-align: left">Scala Version</th> <th style="text-align: center">JVM</th> <th style="text-align: center">JS (1.x)</th> <th style="text-align: center">Native (0.5.x)</th> </tr> </thead> <tbody> <tr> <td style="text-align: left">3.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> <tr> <td style="text-align: left">2.13.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> <tr> <td style="text-align: left">2.12.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> </tbody> </table> sbt 1.10.1 https://eed3si9n.com/sbt-1.10.1 Sun, 07 Jul 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.1 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce that sbt 1.10.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.10.1">https://github.com/sbt/sbt/releases/tag/v1.10.1</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.10.0">1.10.0 release note</a> for the details on 1.10.x features.</p> how to see the trees using the Scala compilers https://eed3si9n.com/trees/ Sat, 06 Jul 2024 00:00:00 +0000 https://eed3si9n.com/trees/ <p>Here&rsquo;s a memo on how to show trees using the Scala compilers. While this likely won&rsquo;t be relevant for normal usage of Scala, having the direct knowledge of the tree can be useful when developing tooling or during metaprogramming.</p> <h2 id="scala-21314">Scala 2.13.14</h2> <p>Let&rsquo;s use the following example:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">package</span> example </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">object</span> <span style="color:#a6e22e">Main</span> <span style="color:#66d9ef">extends</span> <span style="color:#a6e22e">App</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> println<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;hello&#34;</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span> </span></span></code></pre></div><p>Here&rsquo;s how you can show the AST using Scala 2.13.14:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ sdk install scala 2.13.14 </span></span><span style="display:flex;"><span>$ sdk use scala 2.13.14 </span></span><span style="display:flex;"><span>$ scalac --version </span></span><span style="display:flex;"><span>Scala compiler version 2.13.14 -- Copyright 2002-2024, LAMP/EPFL and Lightbend, Inc. </span></span><span style="display:flex;"><span>$ scalac -Vprint:parser,typer -Ystop-after:typer -Yprint-trees:format Hello.scala </span></span></code></pre></div> ten things I like about Scala 3 https://eed3si9n.com/10things/ Mon, 24 Jun 2024 00:00:00 +0000 https://eed3si9n.com/10things/ <p>I am sometimes asked what I like so much about Scala 3, so here&rsquo;s a list in no particular order. Note that this is based on my personal taste informed by how I use Scala 3, and how I&rsquo;d like to use Scala 3 more.</p> <blockquote> <p>I hate it when you make me laugh,<br> even worse when you make me cry<br> I hate it when you&rsquo;re not around and the fact that you didn&rsquo;t call<br> but mostly I hate the way I don&rsquo;t hate you,<br> not even close,<br> not even a little bit,<br> not even at all</p> tree-sitter-scala 0.22.0 https://eed3si9n.com/tree-sitter-scala-0.22.0 Sun, 23 Jun 2024 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.22.0 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.22.0. The first two segments of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number. tree-sitter-scala 0.22.0 uses tree-sitter 0.22.x.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors). We publish Rust binding to <a href="https://crates.io/crates/tree-sitter-scala">crates.io</a>.</p> setup-sbt GitHub Action https://eed3si9n.com/setup-sbt/ Sat, 22 Jun 2024 00:00:00 +0000 https://eed3si9n.com/setup-sbt/ <p>I&rsquo;ve created <code>sbt/setup-sbt</code> action to install the official <code>sbt</code> runner script and the launcher.</p> luminosity of solar radiation (2024.06 mixtape) https://eed3si9n.com/2024.06-mixtape Mon, 03 Jun 2024 00:00:00 +0000 https://eed3si9n.com/2024.06-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/7a2QN2HdonBMPz67VaRG1r?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> <ul> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVgOuRM-36HdrX9VTqj0qfy">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVgOuRM-36HdrX9VTqj0qfy</a></li> </ul> sbt 1.10.0 https://eed3si9n.com/sbt-1.10.0 Mon, 06 May 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.10.0. This is the tenth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <p>The headline features of sbt 1.10.0 are:</p> <ul> <li><a href="https://docs.scala-lang.org/sips/drop-stdlib-forwards-bin-compat.html">SIP-51</a> Support for Scala 2.13 Evolution</li> <li>A wide range of Zinc fixes contributed by Jerry Tan and others</li> <li>CommandProgress API</li> <li>ConsistentAnalysisFormat: New Zinc Analysis serialization</li> </ul> sbt 1.10.0-RC2 https://eed3si9n.com/sbt-1.10.0-beta Mon, 15 Apr 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.10.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.10.0-RC2. This is the tenth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <p>The headline features of sbt 1.10.0 are:</p> <ul> <li><a href="https://docs.scala-lang.org/sips/drop-stdlib-forwards-bin-compat.html">SIP-51</a> Support for Scala 2.13 Evolution</li> <li>A wide range of Zinc fixes contributed by Jerry Tan and others</li> <li>CommandProgress API</li> <li>ConsistentAnalysisFormat: New Zinc Analysis serialization</li> </ul> sbt 2.x remote cache with Bazel compatibility https://eed3si9n.com/sbt-remote-cache-with-bazel-compat/ Fri, 05 Apr 2024 00:00:00 +0000 https://eed3si9n.com/sbt-remote-cache-with-bazel-compat/ <p>This is part 3 of the sbt 2.x remote cache series. I&rsquo;ve have been developing sbt 2.x for a few years in my own free time, and lately Scala Center is joining the effort. These posts are extended PR descriptions to share the features that will come to the future version of sbt, hopefully.</p> <p>About a year ago I proposed a design for automatic cached task for sbt 2.x in <a href="https://eed3si9n.com/sbt-cache-ideas/">RFC-1: sbt cache ideas</a>, and in the <a href="https://eed3si9n.com/sbt-remote-cache">sbt 2.x remote cache</a> post I implemented and dug into the details of caching:</p> sbt-buildinfo 0.12.0 https://eed3si9n.com/sbt-buildinfo-0.12.0 Wed, 20 Mar 2024 00:00:00 +0000 https://eed3si9n.com/sbt-buildinfo-0.12.0 <p>sbt-buildinfo 0.12.0 is released. <a href="https://github.com/sbt/sbt-buildinfo">sbt-buildinfo</a> is a small sbt plugin to generate <code>BuildInfo</code> object from your build definitions.</p> Jar Jar Abrams 1.14.0 and sbt-assembly 2.2.0 https://eed3si9n.com/jarjar-abrams-1.14.0-sbt-assembly-2.2.0 Thu, 14 Mar 2024 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.14.0-sbt-assembly-2.2.0 <p>Jar Jar Abrams 1.14.0 and sbt-assembly 2.2.0 are released.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries.</p> tree-sitter-scala 0.21.0 https://eed3si9n.com/tree-sitter-scala-0.21.0 Wed, 13 Mar 2024 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.21.0 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.20.3 and 0.21.0. The first two segments of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number.</p> <p>tree-sitter-scala 0.21.0 uses tree-sitter 0.21.x; and tree-sitter-scala 0.20.3 uses tree-sitter 0.20.x.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors). We publish Rust binding to <a href="https://crates.io/crates/tree-sitter-scala">crates.io</a>.</p> a letter from chandigarh (2024.03 mixtape) https://eed3si9n.com/2024.03-mixtape Sun, 03 Mar 2024 00:00:00 +0000 https://eed3si9n.com/2024.03-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/4NUkZDCt8DjJMrkR0RQXAk?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> <ul> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotU5B35Av7UzAgiyxsI1Jtbx">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotU5B35Av7UzAgiyxsI1Jtbx</a></li> </ul> sbt-projectmatrix 0.10.0 https://eed3si9n.com/sbt-projectmatrix-0.10.0 Fri, 01 Mar 2024 00:00:00 +0000 https://eed3si9n.com/sbt-projectmatrix-0.10.0 <p>I&rsquo;ve released <a href="https://github.com/sbt/sbt-projectmatrix">sbt-projectmatrix</a> 0.10.0.</p> the holy graal of GitHub Actions https://eed3si9n.com/holy-graal-of-gitHub-actions/ Sun, 25 Feb 2024 00:00:00 +0000 https://eed3si9n.com/holy-graal-of-gitHub-actions/ <p>Last week on <a href="https://github.com/sbt/sbt/issues/7427">sbt/sbt#7427</a> <a href="https://github.com/keynmol">@keynmol</a> (Anton Sviridov) told me:</p> <blockquote> <p>@eed3si9n I think this can be reopened, given that Github finally released free Apple Silicon workers - I think it&rsquo;s best to modify the Github workflow to build all binaries automatically: <a href="https://github.com/sbt/sbtn-dist/pull/11">sbt/sbtn-dist#11</a></p> </blockquote> <p>I guess somehow I missed the memo for a whole month, but I&rsquo;m happy that <a href="https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/">ARM macOS runners are here</a>! In this post, let&rsquo;s dig into how we automated GraalVM native image creation using GitHub Actions. If you&rsquo;re in a hurry, see the working example <a href="https://github.com/sbt/sbtn-dist/blob/ec82e4d25c0f942114c7460868b656089934eb7d/.github/workflows/native.yml">native.yaml</a>.</p> sbt 1.9.9 https://eed3si9n.com/sbt-1.9.9 Fri, 23 Feb 2024 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.9 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.9, a Scala 2.13.13 commemorative patch release. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.9">https://github.com/sbt/sbt/releases/tag/v1.9.9</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>To fix <code>console</code> task on Scala 2.13.13, sbt 1.9.9 backports updates to JLine 3.24.1 and JAnsi 2.4.0 by <a href="https://github.com/hvesalai">@hvesalai</a> in <a href="https://github.com/sbt/sbt/pull/7503">#7503</a> / <a href="https://github.com/sbt/sbt/issues/7502">#7502</a></li> <li>To fix sbt 1.9.8&rsquo;s <code>UnsatisfiedLinkError</code> with <code>stat</code>, sbt 1.9.9 removes native code that was used to get the millisecond-precision timestamp that was broken (<a href="https://bugs.openjdk.org/browse/JDK-8177809">JDK-8177809</a>) on JDK 8 prior to <a href="https://mail.openjdk.org/pipermail/jdk8u-dev/2021-July/014118.html">OpenJDK 8u302</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/io/pull/367">io#367</a></li> </ul> sbt website update 2024 https://eed3si9n.com/sbt-website-update-2024/ Sun, 21 Jan 2024 00:00:00 +0000 https://eed3si9n.com/sbt-website-update-2024/ <p>This is a writeup on sbt&rsquo;s website <a href="https://scala-sbt.org/">scala-sbt.org</a> updates, some concrete, others more of half-baked ideas.</p> <h3 id="background">Background</h3> <p>I&rsquo;ve been the primary maintainer of the site since 2014. Though I have written some of the pages, most of the content had been written by Mark and Havoc by the time I took over. You can see on <a href="https://web.archive.org/web/20140529085505/http://www.scala-sbt.org:80/">2014 archive</a> that the site was Sphinx doc.</p> <p>The first things I did in 2014 on the site was to migrate from <a href="https://www.sphinx-doc.org/">Sphix</a>, which used reStructuredText, to <a href="https://github.com/sbt/website/commit/57bb93275be27eb6c2a58348204bacf1a0a5f90d">Markdown</a> on <a href="https://www.foundweekends.org/pamflet/">Pamflet</a>, a static site generator created by Nathan, and later I inherited.</p> vegan osechi 2024 https://eed3si9n.com/vegan-osechi-2024/ Mon, 01 Jan 2024 00:00:00 +0000 https://eed3si9n.com/vegan-osechi-2024/ <p>My wife and I prepare osechi (お節), japanese new year food some vegan, others non-veg. Some homemade, others store-bought. This year, we tried to stick to vegan, and documented the process. This is mostly for our own reference, but we hope it might help others out there.</p> <h3 id="toshikoshi-soba-年越し蕎麦">toshikoshi soba (年越し蕎麦)</h3> <p><img alt="soba" src="https://eed3si9n.com/recipes/files/soba-2024.jpg"></p> <p>For good luck, we eat soba noodle at midnight, crossing into new year. I have no idea what the noodle is supposed to symbolize. The goal is to finish up most of the cooking by the end of the year, so you can coast the next day.</p> december adventure 2023 https://eed3si9n.com/december-adventure-2023/ Wed, 27 Dec 2023 00:00:00 +0000 https://eed3si9n.com/december-adventure-2023/ <p>Inspired by <a href="http://plastic-idolatry.com/erik/2023/dec/">d6</a> and <a href="https://eli.li/december-adventure">the original</a>, I&rsquo;m going to try to work on something small everyday. I&rsquo;ll post on <a href="https://elk.zone/mastodon.social/@eed3si9n/111511724828068883">Mastodon as well</a>.</p> <p>my goal: work on sbt 2.x, other open source like sbt 1.x and plugins, or some post on this site, like music or recipe.</p> sbt 2.x remote cache https://eed3si9n.com/sbt-remote-cache/ Mon, 18 Dec 2023 00:00:00 +0000 https://eed3si9n.com/sbt-remote-cache/ <h3 id="introduction">introduction</h3> <p>A remote cache, or a cloud build system, can speed up builds dramatically by sharing build results (<a href="https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems.pdf">Mokhov 2018</a>). This is a feature that I&rsquo;ve been interested ever since heard about Blaze (now open sourced as Bazel). In 2020, I implemented <a href="https://eed3si9n.com/cached-compilation-for-sbt">cached compilation</a> in sbt 1.x. <a href="https://reibitto.github.io/blog/remote-caching-with-sbt-and-s3/">reibitto</a> has reported that &ldquo;what was once 7 minutes to compile everything now takes <strong>15 seconds</strong>.&rdquo; Others have also reported <strong>2x ~ 5x</strong> speedup. While this is promising, it&rsquo;s a bit clunky and it works only for the <code>compile</code> task. In March 2023, I jotted down <a href="https://eed3si9n.com/sbt-cache-ideas/">RFC-1: sbt cache ideas</a> to outline the current issues and a solution design. Here are some of the problems:</p> <ul> <li>Problem 1: sbt 1.x implements remote caching for <code>compile</code>, and disk caching for some other tasks, but we would like a solution that custom tasks can participate</li> <li>Problem 2: sbt 1.x has separate mechanism for disk cache and remote cache, but we would like one mechanism that build user can switch between local or remote cache</li> <li>Problem 3: sbt 1.x used Ivy resolver as the cache abstration, but we&rsquo;d like a more open design for remote cache backend</li> </ul> <p>As my <a href="https://eed3si9n.com/december-adventure-2023">december adventure 2023</a> project I decided to tackle the sbt 2.x remote cache feature in my free time. The proposal is on GitHub <a href="https://github.com/sbt/sbt/pull/7464">#7464</a>. This post explores the details of the change. <strong>Note</strong>: It shouldn&rsquo;t require too much of sbt internal knowledge, but the target audience is advanced since this is more of an extended PR description.</p> sbt 1.9.8 https://eed3si9n.com/sbt-1.9.8 Wed, 13 Dec 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.8 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.8 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.8">https://github.com/sbt/sbt/releases/tag/v1.9.8</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes <code>IO.getModifiedOrZero</code> on Alpine etc, by using clib <code>stat()</code> instead of non-standard <code>__xstat64</code> abi by <a href="https://github.com/bratkartoffel">@bratkartoffel</a> in <a href="https://github.com/sbt/io/pull/362">io#362</a></li> </ul> hyperparameter optimization (2023.12 mixtape) https://eed3si9n.com/2023.12-mixtape Fri, 01 Dec 2023 00:00:00 +0000 https://eed3si9n.com/2023.12-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/1Xc0YgsYGj8sNp9q13P16s?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> <ul> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXD7urcAALlcTb7bvBHQQeK">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXD7urcAALlcTb7bvBHQQeK</a></li> </ul> <p>5h7m</p> Eval 0.3.0 https://eed3si9n.com/eval-0.3.0 Sat, 25 Nov 2023 00:00:00 +0000 https://eed3si9n.com/eval-0.3.0 <p>I released Eval 0.3.0 for Scala 3.3.1. <a href="https://github.com/eed3si9n/eval">Eval</a> evaluates Scala 3 code. See <a href="https://eed3si9n.com/eval/">https://eed3si9n.com/eval/</a> for details.</p> Helix and Scala https://eed3si9n.com/helix-and-scala/ Thu, 16 Nov 2023 00:00:00 +0000 https://eed3si9n.com/helix-and-scala/ <p>I recorded a 11 minute video of me pecking around Scala 3 code using my recent favorite editor Helix.</p> <iframe width="560" height="315" src="https://www.youtube.com/embed/uYopbRq62ds?si=grHpwJ2_gev29sLK" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> Jar Jar Abrams 1.13.0 and sbt-assembly 2.1.4 https://eed3si9n.com/jarjar-abrams-1.13.0-sbt-assembly-2.1.4 Fri, 27 Oct 2023 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.13.0-sbt-assembly-2.1.4 <p>Jar Jar Abrams 1.13.0 and sbt-assembly 2.1.4 are released.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries.</p> JDK 21 and 22-ea on GitHub Actions https://eed3si9n.com/jdk-21-and-22-ea-on-github-actions/ Fri, 27 Oct 2023 00:00:00 +0000 https://eed3si9n.com/jdk-21-and-22-ea-on-github-actions/ <p>JDK 21 just came out, and given its LTS status projects are encouraged to test their code on JDK 21. A few projects are already starting to test on JDK 22-ea as well. Here&rsquo;s a quick tutorial of how to test your project on GitHub Actions with JDK 21 or JDK 22-ea using <code>actions/setup-java</code>.</p> <h3 id="jdk-21">JDK 21</h3> <p>For cross building on JDK 21, follow <a href="https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html">Setting up GitHub Actions with sbt</a> on the official docs.</p> sbt 1.9.7 https://eed3si9n.com/sbt-1.9.7 Sun, 22 Oct 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.7 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.7 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.7">https://github.com/sbt/sbt/releases/tag/v1.9.7</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li><a href="https://github.com/sbt/sbt/security/advisories/GHSA-h9mw-grgx-2fhf">CVE-2023-46122</a>. sbt 1.9.7 updates its IO module to 1.9.7, which fixes parent path traversal vulnerability in <code>IO.unzip</code>. This was discovered and reported by Kenji Yoshida (<a href="https://github.com/xuwei-k">@xuwei-k</a>), and fixed by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/io/pull/360">io#360</a>.</li> </ul> ifdef in Scala via pre-typer processing https://eed3si9n.com/ifdef-in-scala-via-pre-typer-processing/ Sun, 15 Oct 2023 00:00:00 +0000 https://eed3si9n.com/ifdef-in-scala-via-pre-typer-processing/ <p>This is part 2 of implementing Rust&rsquo;s <code>cfg</code> attribute in Scala. In <a href="https://eed3si9n.com/ifdef-macro-in-scala">part 1</a>, I tried the annotation macro with a mixed result. I&rsquo;ve implemented a version of <code>@ifdef</code> that works better.</p> <h3 id="what-does-cfg-attribute-do">what does <code>cfg</code> attribute do?</h3> <p><a href="https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/conditional-compilation.html">Rust Programming Language</a> says:</p> <blockquote> <p>Rust has a special attribute, <code>#[cfg]</code>, which allows you to compile code based on a flag passed to the compiler.</p> </blockquote> <p>This lets us write unit test in the same source as the library code like this:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#f92672">..</span>. </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#75715e">#[cfg(test)]</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">mod</span> tests { </span></span><span style="display:flex;"><span> <span style="color:#75715e">#[test]</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">fn</span> <span style="color:#a6e22e">some_test</span>() { </span></span><span style="display:flex;"><span> <span style="color:#f92672">..</span>. </span></span><span style="display:flex;"><span> } </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>When I first heard about this, it sounded a bit absurd since I&rsquo;ve never used languages that embeds tests into the <code>main</code> source code. But now that I&rsquo;ve been working with Rust occasionally, I like the idea of being able to write the tests in the same source, especially for kind of code that can be exercised as functions. When it gets too messy, you can always split them out in <code>src/test/scala/</code> or <code>tests/</code> in Rust.</p> ifdef macro in Scala https://eed3si9n.com/ifdef-macro-in-scala/ Thu, 12 Oct 2023 00:00:00 +0000 https://eed3si9n.com/ifdef-macro-in-scala/ <p><strong>Update 2023-10-15</strong>: There&rsquo;s now a better 0.2.0 that I implemented via <a href="https://eed3si9n.com/ifdef-in-scala-via-pre-typer-processing/">pre-typer processing</a>.</p> <p>Rust has an interesting feature called <code>cfg</code> attribute, which is aware of the build configuration at the language level. This lets us write unit test in the same source as the library code like this:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#f92672">..</span>. </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#75715e">#[cfg(test)]</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">mod</span> tests { </span></span><span style="display:flex;"><span> <span style="color:#75715e">#[test]</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">fn</span> <span style="color:#a6e22e">some_test</span>() { </span></span><span style="display:flex;"><span> <span style="color:#f92672">..</span>. </span></span><span style="display:flex;"><span> } </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>I implemented an <strong>experimental</strong> <code>@ifdef</code> macro that does something similar.</p> Jar Jar Abrams 1.9.0 and sbt-assembly 2.1.3 https://eed3si9n.com/jarjar-abrams-1.9.0-sbt-assembly-2.1.3 Sun, 17 Sep 2023 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.9.0-sbt-assembly-2.1.3 <p>Jar jar Abrams 1.9.0 and sbt-assembly 2.1.3 are released with security vulnerability fixes.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries.</p> sbt 1.9.6 https://eed3si9n.com/sbt-1.9.6 Fri, 15 Sep 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.6 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.6 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.6">https://github.com/sbt/sbt/releases/tag/v1.9.6</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>sbt 1.9.6 reverts &ldquo;internal representation of class symbol names&rdquo;, which caused Scala compiler to generate wrong anonymous class name by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/zinc/pull/1256">sbt/zinc#1256</a>. See <a href="https://github.com/scala/bug/issues/12868">scala/bug#12868</a> for more details.</li> </ul> sbt 1.9.5 https://eed3si9n.com/sbt-1.9.5 Thu, 14 Sep 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.5 <p><strong>Update</strong>: ⚠️ sbt 1.9.5 is broken, because it causes Scala compiler to generate wrong class names for anonymous class on lambda. Please refrain from publishing libraries with it while we investigate. See <a href="https://github.com/scala/bug/issues/12868#issuecomment-1720848704">cala/bug#12868</a> for details.</p> <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.5 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.5">https://github.com/sbt/sbt/releases/tag/v1.9.5</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Switches to pre-compiled compiler bridge for Scala 2.13.12+ <a href="https://github.com/sbt/sbt/pull/7374">#7374</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Fixes NPE when just <code>-X</code> is passed to <code>scalacOptions</code> <a href="https://github.com/sbt/zinc/pull/1246">zinc#1246</a> by <a href="https://github.com/unkarjedy">@unkarjedy</a></li> </ul> angle of attack (2023.09 mixtape) https://eed3si9n.com/2023.09-mixtape Fri, 01 Sep 2023 00:00:00 +0000 https://eed3si9n.com/2023.09-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/5PojpLqc1TYX7PFtA7X6O2?utm_source=generator&theme=0" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> sbt 1.9.4 https://eed3si9n.com/sbt-1.9.4 Thu, 24 Aug 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.4 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.4 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.4">https://github.com/sbt/sbt/releases/tag/v1.9.4</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates Coursier to 2.1.6 to address <a href="https://github.com/advisories/GHSA-2jc4-r94c-rp7h">CVE-2022-46751</a></li> <li>Updates Ivy fork to 2.3.0-sbt-396a783bba347016e7fe30dacc60d355be607fe2 to address <a href="https://github.com/advisories/GHSA-2jc4-r94c-rp7h">CVE-2022-46751</a></li> </ul> tree-sitter-scala 0.20.2 https://eed3si9n.com/tree-sitter-scala-0.20.2 Sun, 20 Aug 2023 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.20.2 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.20.2. The first two segments of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors).</p> sbt 1.9.3 https://eed3si9n.com/sbt-1.9.3 Mon, 24 Jul 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.3 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.3 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.3">https://github.com/sbt/sbt/releases/tag/v1.9.3</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Actionable diagnostics (aka quickfix) fixes</li> </ul> automate refactoring with Bazel + Scalafix https://eed3si9n.com/automate-refactoring-with-bazel-and-scalafix/ Sat, 15 Jul 2023 00:00:00 +0000 https://eed3si9n.com/automate-refactoring-with-bazel-and-scalafix/ <h3 id="about-scalafix">about Scalafix</h3> <p>As a code base becomes larger, it&rsquo;s useful to have language tooling that can perform automatic refactoring. Thankfully, in 2016 Scala Center created <a href="https://scalacenter.github.io/scalafix/">Scalafix</a>. In <a href="https://www.scala-lang.org/blog/2016/10/24/scalafix.html">the announcement blog post</a> Ólafur Geirsson wrote:</p> <blockquote> <p>Scalafix takes care of easy, repetitive and tedious code transformations so you can focus on the changes that truly deserve your attention. In a nutshell, scalafix reads a source file, transforms usage of unsupported features into newer alternatives, and writes the final result back to the original source file.</p> sbt 1.9.2 https://eed3si9n.com/sbt-1.9.2 Thu, 06 Jul 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.2 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.2">https://github.com/sbt/sbt/releases/tag/v1.9.2</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> sbt 1.9.1 https://eed3si9n.com/sbt-1.9.1 Mon, 26 Jun 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.1 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.9.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.9.1">https://github.com/sbt/sbt/releases/tag/v1.9.1</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.9.0">1.9.0 release note</a> for the details on 1.9.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Change of contributor license agreement to Scala CLA, which transfers contribution copyrights to the Scala Center, instead of Lightbend by <a href="https://github.com/julienrf">@julienrf</a> (Julien Richard-Foy is Technical Director at Scala Center) in <a href="https://github.com/sbt/sbt/pull/7306">#7306</a></li> <li>Publishing related bug fixes following up on sbt 1.9.0, contributed by Adrien Piquerez at Scala Center</li> </ul> tree-sitter-scala 0.20.1 https://eed3si9n.com/tree-sitter-scala-0.20.1 Sat, 10 Jun 2023 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.20.1 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.20.1. The first two segment of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors).</p> sbt 1.9.0 https://eed3si9n.com/sbt-1.9.0 Fri, 02 Jun 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.9.0. This is the nineth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <p>The headline features of sbt 1.9.0 are:</p> <ul> <li>POM consistency of sbt plugin publishing</li> <li><code>sbt new</code>, a text-based adventure</li> <li><code>releaseNotesURL</code> setting</li> <li>Deprecation of <code>IntegrationTest</code> configuration</li> </ul> 2023.06 mixtape https://eed3si9n.com/2023.06-mixtape Thu, 01 Jun 2023 00:00:00 +0000 https://eed3si9n.com/2023.06-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/2s13aAtyMOTyUZn7l7GeTv?utm_source=generator&theme=0" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> tree-sitter-scala 0.20.0 https://eed3si9n.com/tree-sitter-scala-0.20.0 Wed, 24 May 2023 00:00:00 +0000 https://eed3si9n.com/tree-sitter-scala-0.20.0 <p>Hi everyone. On behalf of the tree-sitter-scala project, I am happy to announce tree-sitter-scala 0.20.0. The first two segment of the version number comes from the tree-sitter-cli that was used to generate the parser, and the last segment is our actual version number.</p> <h3 id="about-tree-sitter-scala">About tree-sitter-scala</h3> <p>tree-sitter-scala is a Scala parser in C language, generated using Tree-sitter CLI, and conforming to the Tree-sitter API. Tree-sitter parsers are generally fast, incremental, and robust (ok with partial errors).</p> sbt 1.9.0-RC3 https://eed3si9n.com/sbt-1.9.0-beta Mon, 15 May 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.9.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.9.0-RC2. This is the nineth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <p>The headline features of sbt 1.9.0 are:</p> <ul> <li>POM consistency of sbt plugin publishing</li> <li><code>sbt new</code>, a text-based adventure</li> <li><code>releaseNotesURL</code> setting</li> <li>Deprecation of <code>IntegrationTest</code> configuration</li> </ul> sbt 1.8.3 https://eed3si9n.com/sbt-1.8.3 Fri, 12 May 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.8.3 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.8.3 patch release fixing a security vulnerability. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.8.3">https://github.com/sbt/sbt/releases/tag/v1.8.3</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.8.0">1.8.0 release note</a> for the details on 1.8.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes <code>sbt.io.IO.withTemporaryFile</code> not limiting access on Unix-like systems in <a href="https://github.com/sbt/io/pull/344">io#344</a>/<a href="https://github.com/sbt/zinc/pull/1185">zinc#1185</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> making of a hybrid ScalaMatsuri https://eed3si9n.com/making-of-a-hybrid-scalamatsuri/ Mon, 17 Apr 2023 00:00:00 +0000 https://eed3si9n.com/making-of-a-hybrid-scalamatsuri/ <p>A two-day virtual/Tokyo hybrid ScalaMatsuri took place this weekend. Thanks to all the presenters, sponsors, and participants.</p> <p>Lots of bumps and mishaps for sure, but hopefully it was a successful conference. I join as one of 16 ScalaMatsuri organizers, and also gave a talk and an open-mic session as well.</p> RFC-3: drop custom config https://eed3si9n.com/sbt-drop-custom-config/ Sun, 26 Mar 2023 00:00:00 +0000 https://eed3si9n.com/sbt-drop-custom-config/ <ul> <li>Author: Eugene Yokota</li> <li>Date: 2023-03-26</li> <li>Status: <strong>Partially Accepted</strong></li> </ul> <p>In <a href="https://eed3si9n.com/sbt-2.0-ideas">sbt 2.0 ideas</a> I wrote:</p> <blockquote> <p><strong>idea 3-A: limit dependency configuration to <code>Compile</code> and <code>Test</code></strong></p> <p>Here are some more ideas to simplify sbt. sbt generally allows creating of custom dependency configuration, but it doesn&rsquo;t work well. For the most part, anything that requires custom configuration should likely be handled using separate subproject instead.</p> </blockquote> <h2 id="problem-space">problem space</h2> <p>Dependency configuration, such as <code>Compile</code>, <code>Test</code> etc, is a notion directly imported from Apache Ivy&rsquo;s <a href="https://ant.apache.org/ivy/history/2.3.0/ivyfile/configurations.html">configuration</a>, which allows custom configurations and <code>extends</code>-relationship among them. The shift in sbt 0.9 embraced configuration and enabled code reuse via <code>inConfig(...)(...)</code>. However, generally the custom configuration often requires reimplementation of all tasks, and thus the complete knowledge of the internals.</p> RFC-2: sbt 2.0 RFC process https://eed3si9n.com/sbt-2.0-rfc-process Sat, 25 Mar 2023 00:00:00 +0000 https://eed3si9n.com/sbt-2.0-rfc-process <ul> <li>Author: Eugene Yokota</li> <li>Date: 2023-03-25</li> <li>Status: <strong>Implemented</strong></li> </ul> <h2 id="problem-space">problem space</h2> <p>There are various technical decisions around sbt and Zinc that impact the Scala ecosystem, but currently the process of adding new features or changes to existing feature is not well defined. For the most part, the contributors like Scala Center and I come up with ideas and execute them.</p> <h2 id="rfc-process">RFC process</h2> <p>At the Tooling Summit in Lausanne this week, Iulian Dragos suggested we adopt &ldquo;a lightweight process based on RFC (request for comments) docs that can serve as a design document.&rdquo; In general, it would be a good idea to capture motivations and design intent of major changes.</p> RFC-1: sbt cache ideas https://eed3si9n.com/sbt-cache-ideas/ Sun, 19 Mar 2023 00:00:00 +0000 https://eed3si9n.com/sbt-cache-ideas/ <p>In <a href="https://eed3si9n.com/sbt-2.0-ideas">sbt 2.0 ideas</a> I wrote:</p> <blockquote> <p>idea 6: more disk cache and remote cache</p> <p>Extending the idea of cached compilation in sbt 1.4.0, we should generalize the mechanism so any task can participate in the remote caching.</p> </blockquote> <p>Here are some more concrete ideas for caching.</p> <h2 id="problem-space">problem space</h2> <p>To summarize the general problem space, currently setting up disk caching for tasks is a manual work, so it&rsquo;s under-utilized. Remote caching is limited to <a href="https://eed3si9n.com/cached-compilation-for-sbt/">cached compilation</a>.</p> sbt 2.0 ideas https://eed3si9n.com/sbt-2.0-ideas Mon, 13 Mar 2023 00:00:00 +0000 https://eed3si9n.com/sbt-2.0-ideas <p>It&rsquo;s spring time, and spring makes us hopeful. I&rsquo;ll be attending Tooling Summit next week, so I think this would be a good time to gather my toughts around sbt 2.</p> initial vector of descent (2023.03 mixtape) https://eed3si9n.com/2023.03-mixtape Wed, 01 Mar 2023 00:00:00 +0000 https://eed3si9n.com/2023.03-mixtape <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/2EvQ2uZqyIRBofkeDQC3IJ?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> cross build anything with Bazel https://eed3si9n.com/cross-build-anything-with-bazel/ Sun, 19 Feb 2023 00:00:00 +0000 https://eed3si9n.com/cross-build-anything-with-bazel/ <p>Bazel generally prefers monoversioning, in which all targets in the monorepo uses the same version given any library (JUnit or Pandas). Monoversioning greatly reduces the version conflict concerns within the monorepo, and in return enables better code reuse. In practice, monoversioning has a drawback of tying everyone at the hip. If service A, B, C, D, etc are all using Big Framework 1.1, it becomes costly to migrate all to Big Framework 1.2 if there might be a regression. Years would go by, and Big Framework 2.0 might come out, and again, it would be too risky.</p> Jar Jar Abrams 1.8.2 and sbt-assembly 2.1.1 https://eed3si9n.com/jarjar-abrams-1.8.2-sbt-assembly-2.1.1 Sun, 12 Feb 2023 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.8.2-sbt-assembly-2.1.1 <p>Jar jar Abrams 1.8.2 and sbt-assembly 2.1.1 are released.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries.</p> scalaxb 1.9.1 https://eed3si9n.com/scalaxb-1.9.1 Sat, 11 Feb 2023 00:00:00 +0000 https://eed3si9n.com/scalaxb-1.9.1 <p>Released <a href="https://scalaxb.org/scalaxb-1.9.1">scalaxb 1.9.1</a> with Scala 3 support contributed by <a href="https://mastodon.social/@fthomas">@fthomas</a>.</p> sbt 1.8.2 https://eed3si9n.com/sbt-1.8.2 Thu, 05 Jan 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.8.2 <p>Hi everyone. On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.8.2 patch release fixing a few regressions found in sbt 1.8.1. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.8.2">https://github.com/sbt/sbt/releases/tag/v1.8.2</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.8.0">1.8.0 release note</a> for the details on 1.8.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes M1/M2/Aarch64 Mac support by <a href="https://github.com/sbt/sbt/pull/7120">#7120</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Fixes glibc 2.31/Debian 11/Ubuntu 20.04 compatibility <a href="https://github.com/sbt/sbt/issues/7118">#7118</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> sbt 1.8.1 https://eed3si9n.com/sbt-1.8.1 Tue, 03 Jan 2023 00:00:00 +0000 https://eed3si9n.com/sbt-1.8.1 <p>Happy new year! On behalf of the sbt project, I&rsquo;m happy to announce sbt 1.8.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.8.1">https://github.com/sbt/sbt/releases/tag/v1.8.1</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.8.0">1.8.0 release note</a> for the details on 1.8.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes slf4j 2.x getting pulled into the metabuild <a href="https://github.com/sbt/sbt/pull/7115">#7115</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Adds sbtn (GraalVM native client) for Linux on Aarch64 <a href="https://github.com/sbt/ipcsocket/pull/33">ipcsocket#33</a>, <a href="https://github.com/sbt/sbt/pull/7108">#7108</a> etc by <a href="https://github.com/mkurz">@mkurz</a> and <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Fixes BSP support on Windows by making <code>PATH</code> environment variable case insensitive by <a href="https://github.com/sbt/sbt/pull/7085">#7085</a> by <a href="https://github.com/dos65">@dos65</a></li> </ul> 🎄 support Scala Center 🎄 https://eed3si9n.com/support-scala-center-2022/ Thu, 22 Dec 2022 00:00:00 +0000 https://eed3si9n.com/support-scala-center-2022/ <p>The economic cycle seems to come and go like a slow tide, and sometimes the tech companies also get caught in the middle. Fortunately, Scala seems to be used by some of the leading companies, and although I&rsquo;ve started using Scala and have been contributing the community mostly for the pure joy of it, time and time again when I was in a bind the Scala community has helped me back by giving me encouragements and career opportunities. I resigned Twitter about a month ago, but I will be more than ok :)</p> fast Scala 3 parsing with tree-sitter https://eed3si9n.com/fast-scala3-parsing-with-tree-sitter/ Tue, 20 Dec 2022 00:00:00 +0000 https://eed3si9n.com/fast-scala3-parsing-with-tree-sitter/ <img border="0" alt="" src="https://eed3si9n.com/images/ts_sonokai_main2.png" width="100%" /> requiem for effective engineering (2022.12 mixtape) https://eed3si9n.com/2022.12-mixtape Thu, 01 Dec 2022 00:00:00 +0000 https://eed3si9n.com/2022.12-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/2022-12-500x500.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/1Rrhziva29xypzeZM80SKc?si=14d809146ae448d0">https://open.spotify.com/playlist/1Rrhziva29xypzeZM80SKc?si=14d809146ae448d0</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXfSaWywi-bZqNKAsfApbX1">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXfSaWywi-bZqNKAsfApbX1</a></li> </ul> <p>4h9m</p> about me https://eed3si9n.com/about/ Wed, 23 Nov 2022 00:00:00 +0000 https://eed3si9n.com/about/ <p>I am Eugene Yokota (@eed3si9n on <a href="https://twitter.com/eed3si9n">Twitter</a> and <a href="https://github.com/eed3si9n">GitHub</a>), a software engineer with years of experience working on Scala tooling. Most recently I was a Staff Engineer at Twitter&rsquo;s <em>EE Build/Bazel Migration</em> team migrating the largest Scala monorepo into Bazel (See <a href="https://eed3si9n.com/2years-at-twitter/">2 years at Twitter</a> for details).</p> <p>My specialties are researching and documenting complex landscapes of problems through reading, and talking to people, and bringing them into concrete implementations. I&rsquo;m great at taking existing tools, and making them more performant and developer-friendly.</p> <p>I&rsquo;ve been lead sbt maintainer since 2014 (as a side project since 2020), former <a href="https://eed3si9n.com/6years-at-lightbend">Tech Lead of the Lightbend <em>Tooling Team</em></a>, and later a member of the <em>Scala (Compiler) Team</em>. I&rsquo;m passionate about improving developer experience on and off the work, and like to tinker with ideas both through coding and this blog <a href="https://eed3si9n.com/">https://eed3si9n.com/</a> as my personal platform. Here is a select list of my writing/works:</p> <ul> <li><a href="https://eed3si9n.com/cached-compilation-for-sbt">Cached compilation for sbt (2020)</a></li> <li><a href="https://eed3si9n.com/selective-functor-in-sbt">Selective functor in sbt (2020)</a></li> <li><a href="https://eed3si9n.com/equal-protection-under-eq-law">Equal protection under Eq law (2020)</a></li> <li><a href="https://eed3si9n.com/making-conference-a-safer-space">Making conference a safer space for women (2018)</a></li> <li><a href="https://eed3si9n.com/super-shell-for-sbt/">Super shell for sbt (2018)</a></li> <li><a href="https://contributors.scala-lang.org/t/unification-of-sbt-shell-notation-and-build-sbt-dsl/913">Unification of sbt shell notation and build.sbt DSL (2017)</a></li> <li><a href="https://eed3si9n.com/sbt-server-reboot">sbt server reboot (2016)</a></li> <li><a href="https://eed3si9n.com/stricter-scala-with-ynolub">Stricter Scala with -Yno-lub (2015)</a></li> </ul> <p>See also <a href="https://eed3si9n.com/herding-cats/">&lsquo;herding cats&rsquo;</a> series, a tutorial for Typelevel Cats library.</p> 2 years at Twitter https://eed3si9n.com/2years-at-twitter/ Sun, 20 Nov 2022 00:00:00 +0000 https://eed3si9n.com/2years-at-twitter/ <p>I was a Staff Engineer at Twitter&rsquo;s Build/Bazel Migration team. After two incredible years, November 17 was my last day (I took the voluntary separation offer and resigned, not that it matters). Twitter has been a special place to work for, for its culture of excellence, diversity, and outpouring of care for all the people that made Flock the Flock. I am grateful that I got the opportunity to experience that firsthand, and be part of it.</p> <p><img alt="image1" src="https://eed3si9n.com/images/2years.jpg"></p> <p>Here&rsquo;s a quick retrospective on my last two years. Info available here are based on publicly available talks and data. Just from our team 10+ members left Twitter after the buyout, so I&rsquo;ve sprinkled this post with links to their LinkedIn profiles both current and former.</p> sbt 1.8.0 https://eed3si9n.com/sbt-1.8.0 Thu, 10 Nov 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.8.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.8.0. This is the eighth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates Coursier to 2.1.0-RC1 to address <a href="https://github.com/advisories/GHSA-wv7w-rj2x-556x">CVE-2022-37866</a></li> <li>Updates Ivy fork to 2.3.0-sbt-a8f9eb5bf09d0539ea3658a2c2d4e09755b5133e to address <a href="https://github.com/advisories/GHSA-wv7w-rj2x-556x">CVE-2022-37866</a></li> <li>Updates scala-xml to 2.x</li> </ul> sbt 1.8.0-RC1 https://eed3si9n.com/sbt-1.8.0-beta Mon, 07 Nov 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.8.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.8.0-RC1. This is the eighth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <h3 id="highlights">Highlights</h3> <p>sbt 1.8.0 is a small release focused on upgrading scala-xml to 2.x. In theory this breaks the binary compatibility in the plugin ecosystem, but in practice there&rsquo;s already a mixture of both 1.x and 2.x.</p> <p>If you encounter a conflict in plugins, try putting the following in <code>project/plugins.sbt</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> libraryDependencySchemes <span style="color:#f92672">+=</span> <span style="color:#e6db74">&#34;org.scala-lang.modules&#34;</span> <span style="color:#f92672">%%</span> <span style="color:#e6db74">&#34;scala-xml&#34;</span> <span style="color:#f92672">%</span> <span style="color:#a6e22e">VersionScheme</span><span style="color:#f92672">.</span><span style="color:#a6e22e">Always</span> </span></span></code></pre></div> sbt 1.7.3 https://eed3si9n.com/sbt-1.7.3 Sun, 30 Oct 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.7.3 <p>I&rsquo;m happy to announce sbt 1.7.3 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.7.3">https://github.com/sbt/sbt/releases/tag/v1.7.3</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.7.0">1.7.0 release note</a> for the details on 1.7.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates underlying Coursier from 2.1.0-M2 to 2.1.0-M7-18-g67daad6a9 (lm-coursier-shaded 2.0.12) by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> sbt 1.7.2 https://eed3si9n.com/sbt-1.7.2 Mon, 03 Oct 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.7.2 <p>I&rsquo;m happy to announce sbt 1.7.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.7.2">https://github.com/sbt/sbt/releases/tag/v1.7.2</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.7.0">1.7.0 release note</a> for the details on 1.7.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes invalidation of incremental <code>testQuick</code> task <a href="https://github.com/sbt/sbt/pull/6903">#6903</a> by <a href="https://github.com/gontard">@gontard</a></li> <li>Updates <code>sbt new</code> by default to use Giter8 0.15.0</li> <li>Updates launcher to support Scala 3 apps <a href="https://github.com/sbt/sbt/pull/7035">#7035</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Adds <code>diagnosticCode</code> and <code>diagnosticRelatedInforamation</code> (sic) to <code>InterfaceUtil.problem(...)</code> <a href="https://github.com/sbt/sbt/pull/7006">#7006</a> by <a href="https://github.com/ckipp01">@ckipp01</a></li> <li>Forwards <code>diagnosticCode</code> to BSP <a href="https://github.com/sbt/sbt/pull/6998">#6998</a> by <a href="https://github.com/ckipp01">@ckipp01</a></li> </ul> 2022.09 mixtape https://eed3si9n.com/2022.09-mixtape Thu, 01 Sep 2022 00:00:00 +0000 https://eed3si9n.com/2022.09-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/0C5LhI2qb9bh1eApj4Jxq4?si=02ab0478b8c642eb">https://open.spotify.com/playlist/0C5LhI2qb9bh1eApj4Jxq4?si=02ab0478b8c642eb</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWeHtZ6AJT-ZqJtbmR877vl">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWeHtZ6AJT-ZqJtbmR877vl</a></li> </ul> <p>4h2m</p> sbt 1.7.1 https://eed3si9n.com/sbt-1.7.1 Tue, 12 Jul 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.7.1 <p>I&rsquo;m happy to announce sbt 1.7.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.7.1">https://github.com/sbt/sbt/releases/tag/v1.7.1</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.7.0">1.7.0 release note</a> for the details on 1.7.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>Fixes Java incremental compilation, specifically parsing of annotations in class files of <a href="https://github.com/SethTisue">@SethTisue</a> in <a href="https://github.com/sbt/zinc/pull/1111">zinc#1111</a></li> </ul> sbt 1.7.0 https://eed3si9n.com/sbt-1.7.0 Sun, 10 Jul 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.7.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.7.0. This is the seventh feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt runner</strong> from <code>cs setup</code>, SDKMAN, or download from <a href="https://github.com/sbt/sbt/releases/tag/v1.7.0">https://github.com/sbt/sbt/releases/tag/v1.7.0</a>.</p> <p>The sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.7.0 </span></span></code></pre></div><p>This mechanism allows that sbt 1.7.0 is used only for the builds that you want.</p> sbt 1.7.0-RC2 https://eed3si9n.com/sbt-1.7.0-beta Sat, 02 Jul 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.7.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.7.0-RC2. This is the seventh feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> scopt 4.1.0 https://eed3si9n.com/scopt-4.1.0 Sat, 02 Jul 2022 00:00:00 +0000 https://eed3si9n.com/scopt-4.1.0 <p>scopt 4.1.0 is released. To try new scopt 4.1.0:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>libraryDependencies <span style="color:#f92672">+=</span> <span style="color:#e6db74">&#34;com.github.scopt&#34;</span> <span style="color:#f92672">%%</span> <span style="color:#e6db74">&#34;scopt&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;4.1.0&#34;</span> </span></span></code></pre></div><p>scopt 4.1.0 is cross published to the following build matrix:</p> <table> <thead> <tr> <th style="text-align: left">Scala Version</th> <th style="text-align: center">JVM</th> <th style="text-align: center">JS (1.x)</th> <th style="text-align: center">JS (0.6.x)</th> <th style="text-align: center">Native (0.4.x)</th> </tr> </thead> <tbody> <tr> <td style="text-align: left">3.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">n/a</td> <td style="text-align: center">✅</td> </tr> <tr> <td style="text-align: left">2.13.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> <tr> <td style="text-align: left">2.12.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> <tr> <td style="text-align: left">2.11.x</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> <td style="text-align: center">✅</td> </tr> </tbody> </table> <p>scopt is a little command line options parsing library. See <a href="https://eed3si9n.com/scopt4">https://eed3si9n.com/scopt4</a> or <a href="https://github.com/scopt/scopt">readme</a> for the details on how to use scopt.</p> 2022.06 mixtape https://eed3si9n.com/2022.06-mixtape Wed, 01 Jun 2022 00:00:00 +0000 https://eed3si9n.com/2022.06-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/1k4KYcV3dQO2BbGFPc4JNP?si=b94ba11e72b2420e">https://open.spotify.com/playlist/1k4KYcV3dQO2BbGFPc4JNP?si=b94ba11e72b2420e</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWwWDuFf_ZvzjnD0XGEloER">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWwWDuFf_ZvzjnD0XGEloER</a></li> </ul> <p>3h53m</p> Eval 0.1.0 https://eed3si9n.com/eval/ Mon, 28 Mar 2022 00:00:00 +0000 https://eed3si9n.com/eval/ <p>I released Eval 0.1.0. <a href="https://github.com/eed3si9n/eval">Eval</a> evaluates Scala 3 code. It&rsquo;s a Scala 3 port of <code>Eval</code> class used in sbt.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">package</span> example </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> com.eed3si9n.eval.Eval </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> com.eed3si9n.eval.EvalReporter </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> java.nio.file.Paths </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">@main</span> <span style="color:#66d9ef">def</span> main<span style="color:#f92672">()</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Unit</span> <span style="color:#f92672">=</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> eval <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Eval</span><span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> backingDir <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Paths</span><span style="color:#f92672">.</span>get<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/classes&#34;</span><span style="color:#f92672">),</span> </span></span><span style="display:flex;"><span> mkReporter <span style="color:#66d9ef">=</span> <span style="color:#f92672">()</span> <span style="color:#66d9ef">=&gt;</span> <span style="color:#a6e22e">EvalReporter</span><span style="color:#f92672">.</span>store </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> result <span style="color:#66d9ef">=</span> eval<span style="color:#f92672">.</span>evalInfer<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;2&#34;</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> println<span style="color:#f92672">(</span>result<span style="color:#f92672">.</span>tpe<span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> println<span style="color:#f92672">(</span>result<span style="color:#f92672">.</span>getValue<span style="color:#f92672">(</span><span style="color:#66d9ef">this</span><span style="color:#f92672">.</span>getClass<span style="color:#f92672">.</span>getClassLoader<span style="color:#f92672">))</span> </span></span></code></pre></div><p>The above prints:</p> <pre tabindex="0"><code>Int 2 </code></pre> house problems (2022.03 mixtape) https://eed3si9n.com/2022.03-mixtape Wed, 02 Mar 2022 00:00:00 +0000 https://eed3si9n.com/2022.03-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/5b9yqYmU4IoiCnODOBDbX7?si=4416b9b2d22b40e8">https://open.spotify.com/playlist/5b9yqYmU4IoiCnODOBDbX7?si=4416b9b2d22b40e8</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotV6XMYZ-01gisnkdYV5SGfa">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotV6XMYZ-01gisnkdYV5SGfa</a></li> </ul> Jar Jar Abrams 1.8.1 and sbt-assembly 1.2.0 https://eed3si9n.com/jarjar-abrams-1.8.1-sbt-assembly-1.2.0 Sun, 13 Feb 2022 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.8.1-sbt-assembly-1.2.0 <p>Jar Jar Abrams 1.8.1 and sbt-assembly 1.2.0 are released.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries.</p> simplifying sbt with common settings https://eed3si9n.com/simplifying-sbt-with-common-settings/ Mon, 07 Feb 2022 00:00:00 +0000 https://eed3si9n.com/simplifying-sbt-with-common-settings/ <p>sbt is simple, in a sense that it has a few concepts like settings and tasks, and it achieves a wide variety of things. An idea popped into my head today that could simplify sbt further. I don&rsquo;t have an implementation on this yet.</p> sbt 1.6.2 https://eed3si9n.com/sbt-1.6.2 Tue, 01 Feb 2022 00:00:00 +0000 https://eed3si9n.com/sbt-1.6.2 <p>I&rsquo;m happy to announce sbt 1.6.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.6.2">https://github.com/sbt/sbt/releases/tag/v1.6.2</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.6.0">1.6.0 release note</a> for the details on 1.6.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>sbt 1.6.2 adds <code>License</code> object with predefined licenses.</li> <li>Fixes test framework loading failure not failing the build <a href="https://github.com/sbt/sbt/pull/6806">#6806</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> granularity of testing https://eed3si9n.com/granularity-of-testing/ Fri, 31 Dec 2021 00:00:00 +0000 https://eed3si9n.com/granularity-of-testing/ <p>In the context of sbt, Bazel, and likely many other build tools, the term <em>test</em> could encompass various levels, and it&rsquo;s useful to disamgibuate this, especially when we want to configure pre- and post-hooks and parallel execution. In other words, what do we mean when we say &ldquo;test&rdquo;?</p> <p>There are four levels to test:</p> <ol> <li>test command</li> <li>test modules</li> <li>test class</li> <li>test method/expression</li> </ol> <h3 id="test-as-commandline-interface">test as commandline interface</h3> <p>The top-most level is the <code>test</code> command that the build tools provide to the users.</p> sbt 1.6.1 https://eed3si9n.com/sbt-1.6.1 Wed, 29 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.6.1 <p>I&rsquo;m happy to announce sbt 1.6.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.6.1">https://github.com/sbt/sbt/releases/tag/v1.6.1</a></p> <p>See <a href="https://eed3si9n.com/sbt-1.6.0">1.6.0 release note</a> for the details on 1.6.x features.</p> <h3 id="highlights">Highlights</h3> <ul> <li>sbt 1.6.1 updates log4j 2 to 2.17.1, which fixes a remote code execution vulnerability when attacker controls configuration (CVE-2021-44832) <a href="https://github.com/sbt/sbt/pull/6765">#6765</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> sbt 1.6.0 https://eed3si9n.com/sbt-1.6.0 Sun, 26 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.6.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.6.0. This is the sixth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <p>The headline features of sbt 1.6.0 are:</p> <ul> <li>Improved JDK 17 support</li> <li>BSP improvements</li> <li>Zinc improvements</li> <li>Remote caching improvements</li> <li>Tab completion of global keys</li> </ul> sbt 1.5.8 https://eed3si9n.com/sbt-1.5.8 Mon, 20 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.8 <p>I&rsquo;m happy to announce sbt 1.5.8 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.8">https://github.com/sbt/sbt/releases/tag/v1.5.8</a></p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates log4j 2 to 2.17.0, which fixes a denial of service vulnerability caused by infinite recursion (CVE-2021-45105) <a href="https://github.com/sbt/sbt/pull/6755">#6755</a> by <a href="https://github.com/augi">@augi</a></li> </ul> sbt 1.6.0-RC2 https://eed3si9n.com/sbt-1.6.0-beta Sat, 18 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.6.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.6.0-RC2. This is the sixth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.</p> <ul> <li>If no serious issues are found by Saturday, December 25th 2021, 1.6.0-RC2 will become 1.6.0 final.</li> <li><s>If no serious issues are found by Saturday, December 11th 2021, 1.6.0-RC1 will become 1.6.0 final.</s></li> </ul> <p>The headline features of sbt 1.6.0 are:</p> <ul> <li>Improved JDK 17 support</li> <li>BSP improvements</li> <li>Zinc improvements</li> <li>Remote caching improvements</li> <li>Tab completion of global keys</li> </ul> sbt 1.5.7 https://eed3si9n.com/sbt-1.5.7 Wed, 15 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.7 <p>I&rsquo;m happy to announce sbt 1.5.7 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.7">https://github.com/sbt/sbt/releases/tag/v1.5.7</a></p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates log4j 2 to 2.16.0, which disables JNDI lookup and fixes a denial of service vulnerability (CVE-2021-45046) <a href="https://github.com/sbt/sbt/pull/6749">#6749</a> by <a href="https://github.com/augi">@augi</a></li> </ul> sbt 1.5.6 https://eed3si9n.com/sbt-1.5.6 Fri, 10 Dec 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.6 <p>I&rsquo;m happy to announce sbt 1.5.6 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.6">https://github.com/sbt/sbt/releases/tag/v1.5.6</a></p> <h3 id="highlights">Highlights</h3> <ul> <li>Updates log4j 2 to 2.15.0, which fixes remote code execution vulnerability (CVE-2021-44228) <a href="https://github.com/sbt/sbt/pull/6743">#6743</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> 2021.12 mixtape https://eed3si9n.com/2021.12-mixtape Wed, 01 Dec 2021 00:00:00 +0000 https://eed3si9n.com/2021.12-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/2IEYskg1Z5FQjJt9K1oIbu?si=9cd90e576cee4071">https://open.spotify.com/playlist/2IEYskg1Z5FQjJt9K1oIbu?si=9cd90e576cee4071</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVYkGGFGU8Gj5h9vIRh-gI-">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVYkGGFGU8Gj5h9vIRh-gI-</a></li> </ul> sudori part 3 https://eed3si9n.com/sudori-part3/ Fri, 12 Nov 2021 00:00:00 +0000 https://eed3si9n.com/sudori-part3/ <p>I&rsquo;m hacking on a small project called <a href="https://github.com/eed3si9n/sudori">sudori</a>, an experimental sbt. The initial goal is to port the macro to Scala 3. It&rsquo;s an exercise to take the macro apart and see if we can build it from the ground up. This an advanced area of Scala 2 and 3, and I&rsquo;m finding my way around by trial and error. This is part 3.</p> <p>It&rsquo;s been a while since I wrote <a href="https://eed3si9n.com/sudori-part2">part 2</a>, but in between I&rsquo;ve written <a href="https://eed3si9n.com/intro-to-scala-3-macros/">intro to Scala 3 macros</a>, which is sort of a sudori prequel.</p> Starlark 4.2.1 https://eed3si9n.com/starlark-4.2.1 Sun, 26 Sep 2021 00:00:00 +0000 https://eed3si9n.com/starlark-4.2.1 <p><a href="https://github.com/bazelbuild/starlark">Starlark</a> is a dialect of Python, originally designed as a configuration language for the Bazel build tool. Currently there are implementations in Go, Java, and Rust. As far as I know, the main Java implementation of Starlark has only been available as Bazel&rsquo;s source repo on GitHub.</p> <p>Since it would be convenient to have a binary distribution, I&rsquo;ve forked the repo, and published it as <code>&quot;com.eed3si9n.starlark&quot; % &quot;starlark&quot; % &quot;4.2.1&quot;</code> (<code>com.eed3si9n.starlark:starlark:4.2.1</code>) on Maven Central. The code is the same as Bazel 4.2.1.</p> JDK 17 on GitHub Actions https://eed3si9n.com/jdk17-on-github-actions/ Fri, 17 Sep 2021 00:00:00 +0000 https://eed3si9n.com/jdk17-on-github-actions/ <p>Here&rsquo;s a quick tutorial of how to test your project on JDK 17 using Ólaf&rsquo;s <a href="https://github.com/olafurpg/setup-scala">olafurpg/setup-scala</a>. As the starting point we&rsquo;ll use the following setup, which is documented in <a href="https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html#Build+matrix">Setting up GitHub Actions with sbt</a>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">name</span>: <span style="color:#ae81ff">CI</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">on</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">pull_request</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">push</span>: </span></span><span style="display:flex;"><span><span style="color:#f92672">jobs</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">test</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">strategy</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">fail-fast</span>: <span style="color:#66d9ef">false</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">matrix</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">include</span>: </span></span><span style="display:flex;"><span> - <span style="color:#f92672">os</span>: <span style="color:#ae81ff">ubuntu-latest</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">java</span>: <span style="color:#ae81ff">11</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jobtype</span>: <span style="color:#ae81ff">1</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">os</span>: <span style="color:#ae81ff">ubuntu-latest</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">java</span>: <span style="color:#ae81ff">11</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jobtype</span>: <span style="color:#ae81ff">2</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">os</span>: <span style="color:#ae81ff">ubuntu-latest</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">java</span>: <span style="color:#ae81ff">11</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jobtype</span>: <span style="color:#ae81ff">3</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">runs-on</span>: <span style="color:#ae81ff">${{ matrix.os }}</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">steps</span>: </span></span><span style="display:flex;"><span> - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Checkout</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">uses</span>: <span style="color:#ae81ff">actions/checkout@v1</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Setup</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">uses</span>: <span style="color:#ae81ff">olafurpg/setup-scala@v13</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">with</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">java-version</span>: <span style="color:#e6db74">&#34;adopt@1.${{ matrix.java }}&#34;</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">Build and test</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">run</span>: |<span style="color:#e6db74"> </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> case ${{ matrix.jobtype }} in </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> 1) </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> sbt -v &#34;mimaReportBinaryIssues; scalafmtCheckAll; +test;&#34; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> ;; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> 2) </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> sbt -v &#34;scripted actions/*&#34; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> ;; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> 3) </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> sbt -v &#34;dependency-management/*&#34; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> ;; </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> *) </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> echo unknown jobtype </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> exit 1 </span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> esac</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">shell</span>: <span style="color:#ae81ff">bash</span> </span></span></code></pr intro to Scala 3 macros https://eed3si9n.com/intro-to-scala-3-macros/ Mon, 06 Sep 2021 00:00:00 +0000 https://eed3si9n.com/intro-to-scala-3-macros/ <h3 id="introduction">Introduction</h3> <p><a href="https://docs.scala-lang.org/scala3/reference/metaprogramming/macros.html">Macro</a> is a fun and powerful tool, but overuse of the macro could cause harm as well. Please enjoy macros responsibly.</p> <p>What is macro? A common explanation given is that a macro is a program that is able to take code as an input and output code. While it&rsquo;s true, it might not immediately make sense since Scala programmers are often familiar with higher-order functions like (<code>map {...}</code>) and by-name parameter, which on the surface it might seem like it is passing a block of code around.</p> 2021.09 mixtape https://eed3si9n.com/2021.09-mixtape Sun, 05 Sep 2021 00:00:00 +0000 https://eed3si9n.com/2021.09-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/2021-09-500x500.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/1kXfTy2pQuERXZDaCbJNdt?si=e5ffad9e3fc54c98">https://open.spotify.com/playlist/1kXfTy2pQuERXZDaCbJNdt?si=e5ffad9e3fc54c98</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotW9ZN-i4eFjgM-X5CyZ1Z6I">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotW9ZN-i4eFjgM-X5CyZ1Z6I</a></li> </ul> Jar Jar Abrams 1.8.0 and sbt-assembly 1.1.0 https://eed3si9n.com/jarjar-abrams-1.8.0-sbt-assembly-1.1.0 Wed, 01 Sep 2021 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams-1.8.0-sbt-assembly-1.1.0 <p>Jar Jar Abrams 1.8.0 and sbt-assembly 1.1.0 are released.</p> <p><a href="https://eed3si9n.com/jarjar-abrams">Jar Jar Abrams</a> is an experimental extension to Jar Jar Links, intended to shade Scala libraries. Thus far we have been using Pants team&rsquo;s fork of Jar Jar Links, but now that it&rsquo;s been abandaned, Eric Peters has in-sourced it to jarjar-abrams repo so we can patch it.</p> <p>Our <code>jarjar</code> fork is released under <code>com.eed3si9n.jarjar</code> organization name and package name.</p> sudori part 2 https://eed3si9n.com/sudori-part2/ Sun, 01 Aug 2021 00:00:00 +0000 https://eed3si9n.com/sudori-part2/ <p>I&rsquo;m hacking on a small project called <a href="https://github.com/eed3si9n/sudori">sudori</a>, an experimental sbt. The initial goal is to port the macro to Scala 3. It&rsquo;s an exercise to take the macro apart and see if we can build it from the ground up. This an advanced area of Scala 2 and 3, and I&rsquo;m finding my way around by trial and error. This is part 2.</p> <p>Reference:</p> <ul> <li><a href="http://dotty.epfl.ch/docs/reference/metaprogramming/toc.html">Scala 3 Reference: Metaprogramming</a></li> <li><a href="https://eed3si9n.com/sudori-part1">sudori part 1</a></li> </ul> <h3 id="instance">Instance</h3> <p>When we think of the <code>build.sbt</code> macro, the first thing that comes to our mind is the Applicative do macro that it implements using <code>.value</code> even though some may not use those terms exactly. The main driver for this imperative-to-functional is in the companion object for an oddly named <a href="https://github.com/sbt/sbt/blob/v1.5.5/core-macros/src/main/scala/sbt/internal/util/appmacro/Instance.scala">Instance</a> class:</p> sudori part 1 https://eed3si9n.com/sudori-part1/ Sun, 18 Jul 2021 00:00:00 +0000 https://eed3si9n.com/sudori-part1/ <p>I&rsquo;m hacking on a small project called sudori, an experimental sbt. The initial goal is to port the macro to Scala 3. It&rsquo;s an exercise to take the macro apart and see if we can build it from the ground up. This an advanced area of Scala 2 and 3, and I&rsquo;m finding my way around by trial and error.</p> <p>Reference:</p> <ul> <li><a href="http://dotty.epfl.ch/docs/reference/metaprogramming/toc.html">Scala 3 Reference: Metaprogramming</a></li> </ul> <h3 id="convert">Convert</h3> <p>I think I&rsquo;ve identified a basic part called <a href="https://github.com/sbt/sbt/blob/v1.5.5/core-macros/src/main/scala/sbt/internal/util/appmacro/Convert.scala">Convert</a>, which doesn&rsquo;t really depend on anything.</p> sbt 1.5.5 https://eed3si9n.com/sbt-1.5.5 Mon, 12 Jul 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.5 <p>I&rsquo;m happy to announce sbt 1.5.5 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.5">https://github.com/sbt/sbt/releases/tag/v1.5.5</a></p> <h3 id="highlights">Highlights</h3> <ul> <li>Various Zinc fixes and enhancements by <a href="https://github.com/ephemerist">@ephemerist</a> and <a href="https://github.com/retronym">@retronym</a></li> <li>Adds <code>buildTarget/resources</code> support for BSP <a href="https://github.com/sbt/sbt/pull/6552">#6552</a> by <a href="https://github.com/samuelClarencTeads">@samuelClarencTeads</a></li> <li>Adds <code>build.sbt</code> support for BSP import <a href="https://github.com/sbt/sbt/pull/6553">#6553</a> by <a href="https://github.com/retronym">@retronym</a></li> <li>Fixes BSP task error handling <a href="https://github.com/sbt/sbt/pull/6565">#6565</a> by <a href="https://github.com/adpi2">@adpi2</a></li> <li>Fixes remote caching not managing resource files <a href="https://github.com/sbt/sbt/pull/6554">#6554</a> by <a href="https://github.com/Nirvikalpa108">@Nirvikalpa108</a></li> <li>Fixes launcher causing <code>NoClassDefFoundError</code> when launching sbt 1.4.0 - 1.4.2 <a href="https://github.com/sbt/launcher/pull/98">launcher#98</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Fixes cross-Scala suffix conflict warning involving <code>_3</code> <a href="https://github.com/sbt/librarymanagement/pull/383">lm#383</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> </ul> sbt 1.5.4 https://eed3si9n.com/sbt-1.5.4 Mon, 14 Jun 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.4 <p>I&rsquo;m happy to announce sbt 1.5.4 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.4">https://github.com/sbt/sbt/releases/tag/v1.5.4</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt runner + launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.5.4 </span></span></code></pre></div><p>This mechanism allows that sbt 1.5.4 is used only for the builds that you want.</p> sbt-assembly 1.0.0 https://eed3si9n.com/sbt-assembly-1.0.0 Mon, 07 Jun 2021 00:00:00 +0000 https://eed3si9n.com/sbt-assembly-1.0.0 <p>In June of 2011, I started working on sbt-assembly for sbt 0.10, based on Coda Hale&rsquo;s assembly-sbt from sbt 0.7, which in turn was probably inspired by <a href="https://maven.apache.org/plugins/maven-assembly-plugin/">maven-assembly-plugin</a>. After ten years, I&rsquo;m going to call this one 1.0.0. sbt-assembly 1.0.0 is published to Maven Central.</p> sbt 1.5.3 https://eed3si9n.com/sbt-1.5.3 Tue, 01 Jun 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.3 <p>I&rsquo;m happy to announce sbt 1.5.3 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.3">https://github.com/sbt/sbt/releases/tag/v1.5.3</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt runner + launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.5.3 </span></span></code></pre></div><p>This mechanism allows that sbt 1.5.3 is used only for the builds that you want.</p> music inspired by yasuke (2021.06 mixtape) https://eed3si9n.com/2021.06-mixtape Mon, 31 May 2021 00:00:00 +0000 https://eed3si9n.com/2021.06-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/5Q7NulW7CU4HnNyyQpdR6Z?si=3ea3c66015e54f7b">https://open.spotify.com/playlist/5Q7NulW7CU4HnNyyQpdR6Z?si=3ea3c66015e54f7b</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUNhE96_iH0Z6d_1uY8wk4T">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUNhE96_iH0Z6d_1uY8wk4T</a></li> </ul> Scala, Python quick reference https://eed3si9n.com/scala-python-quick-reference/ Sun, 30 May 2021 00:00:00 +0000 https://eed3si9n.com/scala-python-quick-reference/ <table> <thead> <tr> <th style="text-align: left">syntax</th> <th style="text-align: left">Scala</th> <th style="text-align: left">Python</th> </tr> </thead> <tbody> <tr> <td style="text-align: left">immutable variable</td> <td style="text-align: left"><code>val x = 1</code></td> <td style="text-align: left">Starlark:<br><code>REV = &quot;1.1.0&quot;</code></td> </tr> <tr> <td style="text-align: left">lazy variable</td> <td style="text-align: left"><code>lazy val x = 1</code></td> <td style="text-align: left">n/a</td> </tr> <tr> <td style="text-align: left">mutable variable</td> <td style="text-align: left"><code>var x = 1</code></td> <td style="text-align: left">in function:<br><code>x = 1</code></td> </tr> <tr> <td style="text-align: left">if expression</td> <td style="text-align: left"><code>if (x &gt; 1) &quot;a&quot; else &quot;b&quot;</code></td> <td style="text-align: left"><code>&quot;a&quot; if x &gt; 1 else &quot;b&quot;</code></td> </tr> <tr> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> </tr> <tr> <td style="text-align: left">function</td> <td style="text-align: left"><code>def add3(x: Int): Int =</code><br><code> x + 3</code></td> <td style="text-align: left"><code>def add3(x):</code><br><code> return x + 3</code></td> </tr> <tr> <td style="text-align: left">anonymous function</td> <td style="text-align: left"><code>_ * 2</code></td> <td style="text-align: left">not in Starlark:<br><code>lambda x: x * 2</code></td> </tr> <tr> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> </tr> <tr> <td style="text-align: left">List</td> <td style="text-align: left"><code>val xs = List(1, 2, 3, 4)</code></td> <td style="text-align: left"><code>xs = [1, 2, 3, 4]</code></td> </tr> <tr> <td style="text-align: left">size</td> <td style="text-align: left"><code>xs.size</code></td> <td style="text-align: left"><code>len(xs)</code></td> </tr> <tr> <td style="text-align: left">empty test</td> <td style="text-align: left"><code>xs.isEmpty</code></td> <td style="text-align: left"><code>not xs</code></td> </tr> <tr> <td style="text-align: left">head</td> <td style="text-align: left"><code>xs.head</code></td> <td style="text-align: left"><code>xs[0]</code></td> </tr> <tr> <td style="text-align: left">tail</td> <td style="text-align: left"><code>// List(2, 3, 4)</code><br><code>xs.tail</code></td> <td style="text-align: left"><code># [2, 3, 4]</code><br><code>xs[1:]</code></td> </tr> <tr> <td style="text-align: left">take</td> <td style="text-align: left"><code>// List(1, 2)</code><br><code>xs.take(2)</code></td> <td style="text-align: left"><code># [1, 2]</code><br><code>xs[:2]</code></td> </tr> <tr> <td style="text-align: left">drop</td> <td style="text-align: left"><code>// List(3, 4)</code><br><code>xs.drop(2)</code></td> <td style="text-align: left"><code># [3, 4]</code><br><code>xs[2:]</code></td> </tr> <tr> <td style="text-align: left">drop right</td> <td style="text-align: left"><code>// List(1, 2, 3)</code><br><code>xs.dropRight(1)</code></td> <td style="text-align: left"><code># [1, 2, 3]</code><br><code>xs[:-1]</code></td> </tr> <tr> <td style="text-align: left">nth element</td> <td style="text-align: left"><code>xs(2)</code></td> <td style="text-align: left"><code>xs[2]</code></td> </tr> <tr> <td style="text-align: left">map</td> <td style="text-align: left"><code>xs.map(_ * 2)</code><br><br><code>for {</code><br><code> x &lt;- xs</code><br><code>} yield x * 2</code></td> <td style="text-align: left"><code>map(lambda x: x * 2, xs)</code><br><br><code>[x * 2 for x in xs]</code></td> </tr> <tr> <td style="text-align: left">filter</td> <td style="text-align: left"><code>xs.filter(_ % 2 == 0)</code><br><br><code>for {</code><br><code> x &lt;- xs if x % 2 == 0</code><br><code>} yield x</code></td> <td style="text-align: left"><code>filter(lambda x: not x % 2, xs)</code><br><br><code>[x for x in xs if not x % 2 ]</code></td> </tr> <tr> <td style="text-align: left">fold from left</td> <td style="text-align: left"><code>// &quot;a1234&quot;</code><br><code>xs.foldLeft(&quot;a&quot;) { _ + _ }</code></td> <td style="text-align: left"><code>from functools import reduce</code><br><code># &quot;a1234&quot;</code><br><code>reduce(lambda a,x: a + str(x), xs, &quot;a&quot;)</code></td> </tr> <tr> <td style="text-align: left">membership</td> <td style="text-align: left"><code>xs.contains(3)</code></td> <td style="text-align: left"><code>3 in xs</code></td> </tr> <tr> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> </tr> <tr> <td style="text-align: left">String</td> <td style="text-align: left"><code>val s = &quot;hello&quot;</code></td> <td style="text-align: left"><code>s = &quot;hello&quot;</code></td> </tr> <tr> <td style="text-align: left">variable interpolation</td> <td style="text-align: left"><code>val count = 3</code><br><code>s&quot;$count items&quot;</code></td> <td style="text-align: left">not in Starlark:<br><code>count = 3</code><br><code>f&quot;{count} items&quot;</code></td> </tr> <tr> <td style="text-align: left">split</td> <td style="text-align: left"><code>// Array(1.2.3, M1)</code><br><code>&quot;1.2.3-M1&quot;.split(&quot;-&quot;)</code></td> <td style="text-align: left"><code># ['1.2.3', 'M1']</code><br><code>&quot;1.2.3-M1&quot;.split(&quot;-&quot;)</code></td> </tr> <tr> <td style="text-align: left">substring test</td> <td style="text-align: left"><code>s.contains(&quot;el&quot;)</code></td> <td style="text-align: left"><code>&quot;el&quot; in s</code></td> </tr> <tr> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> <td style="text-align: left">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;-</td> </tr> <tr> <td style="text-align: left">Map</td> <td style="text-align: left"><code>val d = Map(&quot;a&quot; -&gt; 1,</code><br><code> &ldquo;b&rdquo; -&gt; 2)</code></td> <td style="text-align: left"><code>d = { &quot;a&quot;: 1, &quot;b&quot;: 2 }</code></td> </tr> </tbody> </table> <ul> <li><a href="https://docs.bazel.build/versions/master/skylark/lib/skylark-overview.html">Skylark one-page overview</a></li> <li>Many of the examples were borrowed from <a href="https://hyperpolyglot.org/rust">Hyperpolyglot: Rust, Swift, Scala</a></li> </ul> <h3 id="notes">notes</h3> <p>I&rsquo;m picking up Python and its Bazel dialect Skylark lately. On the other hand, I&rsquo;m familiar with Scala and its sbt dialect. Often I know exactly what I want to express, and I am fairly certain Python has the equivalent concept as Scala, but just don&rsquo;t remember the exact incantation. For people starting Scala, maybe they could use this table in reverse.</p> POM consistency for sbt plugins https://eed3si9n.com/pom-consistency-for-sbt-plugins/ Sun, 23 May 2021 00:00:00 +0000 https://eed3si9n.com/pom-consistency-for-sbt-plugins/ <p>There&rsquo;s a long-standing bug that sbt maintainers have known for a while, which is that when sbt plugin is published to a Maven repository, the POM file sbt generates is not valid. From a mailing list thread titled <a href="https://groups.google.com/g/simple-build-tool/c/qH7xE0jvBMk/m/LMt6wlkTMRoJ">[0.12] plan</a> for instance, Mark McBride reported it in 2012:</p> <blockquote> <p>On the maven note, the poms generated for plugins aren&rsquo;t actually valid. Trying to upload them to artifactory without disabling pom consistency checks fails :/</p> sbt 1.5.2 https://eed3si9n.com/sbt-1.5.2 Mon, 10 May 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.2 <p>I&rsquo;m happy to announce sbt 1.5.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.2">https://github.com/sbt/sbt/releases/tag/v1.5.2</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt runner + launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.5.2 </span></span></code></pre></div><p>This mechanism allows that sbt 1.5.2 is used only for the builds that you want.</p> Bintray to JFrog Artifactory migration status and sbt 1.5.1 https://eed3si9n.com/bintray-to-jfrog-artifactory-migration-status-and-sbt-1.5.1 Mon, 26 Apr 2021 00:00:00 +0000 https://eed3si9n.com/bintray-to-jfrog-artifactory-migration-status-and-sbt-1.5.1 <p>I&rsquo;m happy to announce sbt 1.5.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.5.1">https://github.com/sbt/sbt/releases/tag/v1.5.1</a>. This post will also report the Bintray to JFrog Artifactory migration.</p> <h3 id="bintray-to-jfrog-artifactory-migration-status">Bintray to JFrog Artifactory migration status</h3> <p>First and foremost, I would like to thank JFrog for their continued support of sbt project and the Scala ecosystem.</p> <p>As sbt was taking off in the number of contributors and plugins, we had a Bintray-shaped problem. We wanted individuals to create Ivy-layout repository, publish sbt plugins, but somehow aggregate the resolution to them. Having Github sbt organization allowed fluid ownership of plugin sources, but distributing the binary files were challenge as sbt version was churning. We adopted Bintray in 2014 and it provided the distribution mechanism during our growth years. In addition, we used Bintray to host Debian and RPM installers for sbt, paid for by Lightbend.</p> herding cats: day 19 https://eed3si9n.com/herding-cats-day19/ Mon, 19 Apr 2021 00:00:00 +0000 https://eed3si9n.com/herding-cats-day19/ <p>Wrote <a href="https://eed3si9n.com/herding-cats/day19.html">herding cats: day 19</a> featuring <code>FunctionK</code>, or Rúnar&rsquo;s encoding of rank-2 polymorphic function, and Resource datatype, which he envisioned rank-N polymorphism would unlock back in 2010.</p> sbt 1.5.0 https://eed3si9n.com/sbt-1.5.0 Sun, 04 Apr 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.5.0. This is the fifth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series.</p> <p>The headline features of sbt 1.5.0 are:</p> <ul> <li>Scala 3 support</li> <li>Eviction error</li> <li>Deprecation of sbt 0.13 syntax</li> <li>Coursier-based launcher</li> </ul> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/tag/v1.5.0">https://github.com/sbt/sbt/releases/tag/v1.5.0</a>. This installer includes the new Coursier-based launcher.</p> sbt 1.5.0-RC2 https://eed3si9n.com/sbt-1.5.0-beta Mon, 22 Mar 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.5.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.5.0-RC2. This is the fifth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series.</p> <ul> <li>If no serious issues are found by Saturday, April 3rd 2021, 1.5.0-RC2 will become 1.5.0 final.</li> <li><s>If no serious issues are found by Saturday, March 27th 2021, 1.5.0-RC1 will become 1.5.0 final.</s></li> </ul> <p>The headline features of sbt 1.5.0 are:</p> sbt 1.4.9 https://eed3si9n.com/sbt-1.4.9 Wed, 10 Mar 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.9 <p>I&rsquo;m happy to announce sbt 1.4.9 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.9">https://github.com/sbt/sbt/releases/tag/v1.4.9</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.9 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.9 is used only for the builds that you want.</p> sbt 1.4.8 https://eed3si9n.com/sbt-1.4.8 Mon, 08 Mar 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.8 <p>I&rsquo;m happy to announce sbt 1.4.8 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.8">https://github.com/sbt/sbt/releases/tag/v1.4.8</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.8 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.8 is used only for the builds that you want.</p> 2021.03 mixtape https://eed3si9n.com/2021.03-mixtape Mon, 01 Mar 2021 00:00:00 +0000 https://eed3si9n.com/2021.03-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/7gKVh3FKdBSXFxXNcgzIkO?si=qeM2_Xw4RsyRqZXGtuklmg">https://open.spotify.com/playlist/7gKVh3FKdBSXFxXNcgzIkO?si=qeM2_Xw4RsyRqZXGtuklmg</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWTDzugvaq7XE_B9sZlKPXk">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotWTDzugvaq7XE_B9sZlKPXk</a></li> </ul> syntactic Scalafix rule for unified slash syntax https://eed3si9n.com/syntactic-scalafix-rule-for-unified-slash-syntax/ Tue, 16 Feb 2021 00:00:00 +0000 https://eed3si9n.com/syntactic-scalafix-rule-for-unified-slash-syntax/ <p>In sbt 1.1.0 I implemented unified slash syntax for sbt. Today I sent a pull request to deprecate the old sbt 0.13 shell syntax <a href="https://github.com/sbt/sbt/pull/6309">#6309</a>.</p> <p>Naturally, the topic of deprecating old syntax for <code>build.sbt</code> also <a href="https://twitter.com/dwijnand/status/1361425290182995969">came</a> <a href="https://twitter.com/SethTisue/status/1361466421847330818">up</a>.</p> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">will you also deprecate `scalacOptions in (Compile, console)` in *.sbt and *.scala files? I hope so</p>&mdash; Seth Tisue (@SethTisue) <a href="https://twitter.com/SethTisue/status/1361466421847330818?ref_src=twsrc%5Etfw">February 16, 2021</a></blockquote> <p>This is because &ldquo;unified&rdquo; slash syntax is called so because it unifies the shell syntax and the build syntax together. Thus, it makes sense to deprecate the old <code>build.sbt</code> syntax that uses <code>in</code> like <code>skip in publish</code> or <code>scalacOptions in (Compile, console)</code>, if we&rsquo;re deprecating the old shell syntax.</p> git bisecting scala/scala https://eed3si9n.com/git-bisecting-scala-scala/ Sat, 06 Feb 2021 00:00:00 +0000 https://eed3si9n.com/git-bisecting-scala-scala/ git bisecting is a useful technique to locate the source of a bug. For scala/scala in particular, <code>bisect.sh</code> can save a lot of time by using the pre-build compiler artifacts on the Scala CI Artifactory. sbt 1.4.7 https://eed3si9n.com/sbt-1.4.7 Sun, 31 Jan 2021 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.7 <p>I&rsquo;m happy to announce sbt 1.4.7 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.7">https://github.com/sbt/sbt/releases/tag/v1.4.7</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.7 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.7 is used only for the builds that you want.</p> sbt 1.4.6 https://eed3si9n.com/sbt-1.4.6 Thu, 24 Dec 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.6 <p>I&rsquo;m happy to announce sbt 1.4.6 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.6">https://github.com/sbt/sbt/releases/tag/v1.4.6</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.6 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.6 is used only for the builds that you want.</p> enforcing Semantic Versioning with sbt-strict-update https://eed3si9n.com/enforcing-semver-with-sbt-strict-update/ Mon, 14 Dec 2020 00:00:00 +0000 https://eed3si9n.com/enforcing-semver-with-sbt-strict-update/ <p><a href="https://twitter.com/tpolecat/status/1338168877474308097">Rob wrote</a>:</p> <blockquote> <p>I want to tell sbt &ldquo;this specific version breaks binary compatibility, so don&rsquo;t resolve it via eviction, fail the build instead.&rdquo; How do I do this? Complete answers only, I&rsquo;m done trying to figure it out by following clues.</p> </blockquote> <p>I wrote a small sbt plugin <a href="https://github.com/sbt/sbt-strict-update">sbt-strict-update</a> to do this.</p> <p>Add this to <code>project/plugins.sbt</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>addSbtPlugin<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;com.eed3si9n&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;sbt-strict-update&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;0.1.0&#34;</span><span style="color:#f92672">)</span> </span></span></code></pr sbt 1.4.5 https://eed3si9n.com/sbt-1.4.5 Mon, 14 Dec 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.5 <p>I&rsquo;m happy to announce sbt 1.4.5 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.5">https://github.com/sbt/sbt/releases/tag/v1.4.5</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.5 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.5 is used only for the builds that you want.</p> unit of intensive care (2020.12 mixtape) https://eed3si9n.com/2020.12-mixtape Fri, 04 Dec 2020 00:00:00 +0000 https://eed3si9n.com/2020.12-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/1mQ6JuDwWlYvuqqji53E4N?si=AopTuNoTTyCVBcOraXiZ-w">https://open.spotify.com/playlist/1mQ6JuDwWlYvuqqji53E4N?si=AopTuNoTTyCVBcOraXiZ-w</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotW71OG0WR0XTJl3IlcJGNIZ">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotW71OG0WR0XTJl3IlcJGNIZ</a></li> </ul> <p>4h</p> auto publish sbt plugin from GitHub Actions https://eed3si9n.com/auto-publish-sbt-plugin-from-github-actions/ Tue, 01 Dec 2020 00:00:00 +0000 https://eed3si9n.com/auto-publish-sbt-plugin-from-github-actions/ <p>This is a GitHub Actions version of <a href="https://eed3si9n.com/auto-publish-sbt-plugin">auto publish sbt plugin from Travis CI</a>.</p> <p>In this post, we&rsquo;ll try to automate the release of an sbt plugin using Ólaf&rsquo;s <a href="https://github.com/olafurpg/sbt-ci-release">olafurpg/sbt-ci-release</a>. The README of sbt-ci-release covers the use case for a library published to Sonatype OSS. Read it thoroughly since this post will skip over the details that do not change for publishing sbt plugins.</p> <p>Automated release in general is a best practice, but there&rsquo;s one benefit specifically for sbt plugin releases. Using this setup allows multiple people to share the authorization to release an sbt plugin without adding them to Bintray sbt organization. This is useful for plugins maintained at work.</p> scopt 4 https://eed3si9n.com/scopt4/ Sun, 29 Nov 2020 00:00:00 +0000 https://eed3si9n.com/scopt4/ <blockquote> <p>This post was first published in December 2018 together with 4.0.0-RC2. It&rsquo;s updated to reflect the changes made in November 2020 for 4.0.0.</p> </blockquote> <p>You can skip to the <a href="https://github.com/scopt/scopt">readme</a>, if you&rsquo;re in a hurry.</p> <p>To try new scopt 4.0.0:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>libraryDependencies <span style="color:#f92672">+=</span> <span style="color:#e6db74">&#34;com.github.scopt&#34;</span> <span style="color:#f92672">%%</span> <span style="color:#e6db74">&#34;scopt&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;4.0.0&#34;</span> </span></span></code></pre></div><p>scopt 4.0.0 is cross published for the following build matrix:</p> Weehawken-Lang1 https://eed3si9n.com/weehawken-lang1/ Tue, 24 Nov 2020 00:00:00 +0000 https://eed3si9n.com/weehawken-lang1/ <h3 id="about-weehawken-lang">about Weehawken-Lang</h3> <p>It&rsquo;s a strange time we live in. We can&rsquo;t just meet up and catch up and talk about coding. This also opens an opportunity to think more virtually about the idea of meetups.</p> <p>I want to start Weehawken-Lang, a virtual meetup group about programming languages and tooling design (compilers, interpreters, build tools etc). It aims to be a casual place where people with different language backgrounds can exchange ideas about programming languages.</p> sbt 1.4.4 https://eed3si9n.com/sbt-1.4.4 Mon, 23 Nov 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.4 <p>I&rsquo;m happy to announce sbt 1.4.4 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.4">https://github.com/sbt/sbt/releases/tag/v1.4.4</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.4 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.4 is used only for the builds that you want.</p> sbt 1.4.3 https://eed3si9n.com/sbt-1.4.3 Mon, 16 Nov 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.3 <p>I&rsquo;m happy to announce sbt 1.4.3 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.3">https://github.com/sbt/sbt/releases/tag/v1.4.3</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>. This installer includes the <code>sbtn</code> binary.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.3 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.3 is used only for the builds that you want.</p> sbt 1.4.2 https://eed3si9n.com/sbt-1.4.2 Mon, 02 Nov 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.2 <p>I&rsquo;m happy to announce sbt 1.4.2 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.2">https://github.com/sbt/sbt/releases/tag/v1.4.2</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://github.com/sbt/sbt/releases/">https://github.com/sbt/sbt/releases/</a>. This installer includes the <code>sbtn</code> binary.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.2 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.2 is used only for the builds that you want.</p> remote caching sbt builds with Bintray https://eed3si9n.com/remote-caching-sbt-builds-with-bintray/ Sun, 25 Oct 2020 00:00:00 +0000 https://eed3si9n.com/remote-caching-sbt-builds-with-bintray/ <p>The feature in sbt and Zinc 1.4.x that I spent most amount of time and energy probably is the virtualization of file, and lifting out timestamps. Combined together, we can liberate the Zinc state from machine-specificity and time, and become the foundation we lay towards building incremental remote caching for Scala. I blogged about this in <a href="https://eed3si9n.com/cached-compilation-for-sbt">cached compilation for sbt</a>. This is part 2.</p> <p>Now that sbt 1.4.x is out, there is a growing interest in this feature among people who want to try this out.</p> sbt 1.4.1 https://eed3si9n.com/sbt-1.4.1 Mon, 19 Oct 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.1 <p>I&rsquo;m happy to announce sbt 1.4.1 patch release is available. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.4.1">https://github.com/sbt/sbt/releases/tag/v1.4.1</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Download <strong>the official sbt launcher</strong> from SDKMAN or download from <a href="https://www.scala-sbt.org/download.html">https://www.scala-sbt.org/download.html</a>. This installer includes the <code>sbtn</code> binary.</p> <p>In addition, the sbt version used for your build is upgraded by putting the following in <code>project/build.properties</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sbt.version<span style="color:#f92672">=</span>1.4.1 </span></span></code></pre></div><p>This mechanism allows that sbt 1.4.1 is used only for the builds that you want.</p> virtualizing a hackathon at ScalaMatsuri 2020 https://eed3si9n.com/virtualizing-hackathon-at-scalamatsuri2020/ Mon, 19 Oct 2020 00:00:00 +0000 https://eed3si9n.com/virtualizing-hackathon-at-scalamatsuri2020/ <p>Here&rsquo;s a report of running a virtual hackathon at ScalaMatsuri Day 2 Unconference. Someone proposed it for the Unconference, and I volunteered to be a facilitator on the day, so I went in without preparation. I booked the time originally for 4h (noon - 4pm JST, 11pm - 3am EDT) but it was successful so it got extended after some coffee break.</p> <p>One thing I emphasize is The Law of Two Feet:</p> Equality in Scala https://eed3si9n.com/equality-scalamatsuri2020/ Sun, 18 Oct 2020 00:00:00 +0000 https://eed3si9n.com/equality-scalamatsuri2020/ <p>I gave a talk at ScalaMatsuri on &lsquo;Equality in Scala&rsquo;</p> <ul> <li><a href="https://eed3si9n.com/equalty">slides: https://eed3si9n.com/equalty</a></li> <li><a href="https://www.slideshare.net/EugeneYokota/equality-in-scala-scalamatsuri-2020">pdf</a></li> </ul> sbt 1.4.0 https://eed3si9n.com/sbt-1.4.0 Mon, 05 Oct 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.0 <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.4.0. This is the fourth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series.</p> <p>The headline features of sbt 1.4.0 are:</p> <ul> <li>build server protocol (BSP) support</li> <li>sbtn: a native thin client for sbt</li> <li>build caching</li> <li><code>ThisBuild / versionScheme</code> to take the guessing out of eviction warning</li> </ul> sbt 1.4.0-RC2 https://eed3si9n.com/sbt-1.4.0-beta Wed, 23 Sep 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.4.0-beta <p>Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.4.0-RC2. This is the fourth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series.</p> <ul> <li>If no serious issues are found by Saturday, October 3rd 2020, 1.4.0-RC2 will become 1.4.0 final.</li> <li><s>If no serious issues are found by Saturday, September 19th 2020, 1.4.0-RC1 will become 1.4.0 final.</s></li> </ul> <p>The headline features of sbt 1.4.0 are:</p> <ul> <li>build server protocol (BSP) support</li> <li>sbtn: a native thin client for sbt</li> <li>build caching</li> <li><code>ThisBuild / versionScheme</code> to take the guessing out of eviction warning</li> </ul> metropolitan house supply (2020.09 mixtape) https://eed3si9n.com/2020.09-mixtape Mon, 31 Aug 2020 00:00:00 +0000 https://eed3si9n.com/2020.09-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/2020-09-500x500.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/62RqkwMDQ6k8o88fjE7Oc2?si=8tT0-NnoRUK3E0-Kug1akg">https://open.spotify.com/playlist/62RqkwMDQ6k8o88fjE7Oc2?si=8tT0-NnoRUK3E0-Kug1akg</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVrO_XPe6q_yrfcpYFegLwG">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVrO_XPe6q_yrfcpYFegLwG</a></li> </ul> <p>4h 29m</p> parallel cross building sandwich https://eed3si9n.com/parallel-cross-building-sandwich/ Mon, 24 Aug 2020 00:00:00 +0000 https://eed3si9n.com/parallel-cross-building-sandwich/ <p>This is part 4 of the post about <a href="https://github.com/sbt/sbt-projectmatrix/">sbt-projectmatrix</a>, an experimental plugin that I&rsquo;ve been working to improve the cross building in sbt. Here&rsquo;s <a href="http://eed3si9n.com/parallel-cross-building-using-sbt-projectmatrix">part 1</a>, <a href="http://eed3si9n.com/parallel-cross-building-with-virtualaxis">part 2</a>, and <a href="http://eed3si9n.com/parallel-cross-building-part3">part 3</a>. I&rsquo;ve just released 0.6.0.</p> <h3 id="recap-building-against-multiple-scala-versions">recap: building against multiple Scala versions</h3> <p>After adding sbt-projectmatrix to your build, here&rsquo;s how you can set up a matrix with two Scala versions.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.12&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> version <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.1.0-SNAPSHOT&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> core <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>projectMatrix in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;core&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;core&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>jvmPlatform<span style="color:#f92672">(</span>scalaVersions <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;2.12.12&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;2.13.3&#34;</span><span style="color:#f92672">))</span> </span></span></code></pr joining Twitter https://eed3si9n.com/joining-twitter/ Mon, 17 Aug 2020 00:00:00 +0000 https://eed3si9n.com/joining-twitter/ <p>I&rsquo;m excited to announce that I&rsquo;m joining Twitter&rsquo;s Build Team to work on the next generation of efficient build systems supporting thousands of Twitter developers worldwide. Today&rsquo;s my first day.</p> <p>This is the team that developed monorepo build tool <a href="https://v1.pantsbuild.org/">Pants</a>, and is transitioning to migrate the flock to <a href="https://bazel.build/">Bazel</a>. This presented a unique opportunity for me to work with a team of people passionate about developer experience and productivity, and I&rsquo;m looking forward to getting to know the team, and learning the new challenges.</p> sbt-buildinfo 0.10.0 https://eed3si9n.com/sbt-buildinfo-0.10.0 Sun, 09 Aug 2020 00:00:00 +0000 https://eed3si9n.com/sbt-buildinfo-0.10.0 <p>I&rsquo;m happy to announce sbt-buildinfo 0.10.0. <a href="https://github.com/sbt/sbt-buildinfo">sbt-buildinfo</a> is a small sbt plugin to generate <code>BuildInfo</code> object from your build definitions.</p> <p>Since the last feature release was in 2018, there have been some pending contributions. I think the important thing is that it compiles with <code>-Xlint</code> and <code>-Xfatal-warnings</code> on both Scala 2.13.3 and 2.12.12.</p> auto publish sbt plugin from Travis CI https://eed3si9n.com/auto-publish-sbt-plugin/ Sat, 08 Aug 2020 00:00:00 +0000 https://eed3si9n.com/auto-publish-sbt-plugin/ <p>In this post, we&rsquo;ll try to automate the release of an sbt plugin using Ólafur&rsquo;s <a href="https://github.com/olafurpg/sbt-ci-release">olafurpg/sbt-ci-release</a>. The README of sbt-ci-release covers the use case for a library published to Sonatype OSS. Read it thoroughly since this post will skip over the details that do not change for publishing sbt plugins.</p> <p>Automated release in general is a best practice, but there&rsquo;s one benefit specifically for sbt plugin releases. Using this setup allows multiple people to share the authorization to release an sbt plugin without adding them to Bintray sbt organization. This is useful for plugins maintained at work.</p> pb by j https://eed3si9n.com/pb-by-j/ Mon, 03 Aug 2020 00:00:00 +0000 https://eed3si9n.com/pb-by-j/ <p>Spotify: <a href="https://open.spotify.com/playlist/5BkvksBTbrngqXxhF6wUAc?si=Kj8TrnhRQICDTgadvYYt2w">https://open.spotify.com/playlist/5BkvksBTbrngqXxhF6wUAc?si=Kj8TrnhRQICDTgadvYYt2w</a> YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXfMWZPzm6K_L0CRPgFhxGh">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXfMWZPzm6K_L0CRPgFhxGh</a> 2h 4m</p> Defx: file explorer plugin for Neovim https://eed3si9n.com/defx/ Thu, 09 Jul 2020 00:00:00 +0000 https://eed3si9n.com/defx/ <img border="0" alt="" src="https://eed3si9n.com/images/defx.gif" width="100%" /> sbt 1.3.13 https://eed3si9n.com/sbt-1.3.13 Sat, 27 Jun 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.3.13 <p>I&rsquo;m happy to announce sbt 1.3.13 patch release. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.3.13">https://github.com/sbt/sbt/releases/tag/v1.3.13</a>.</p> <p>Special thanks to Scala Center. It takes time to review bug reports, pull requests, make sure contributions land to the right places, and Scala Center sponsored me to do maintainer tasks for sbt during June.</p> reentrance protocol (2020.06 mixtape) https://eed3si9n.com/2020.06-mixtape Mon, 01 Jun 2020 00:00:00 +0000 https://eed3si9n.com/2020.06-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/2020-06-500x500.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/4fAHIQhqD4GdaqoCZVrULG?si=crwaw9y-Q-yfqwErXiTqJg">https://open.spotify.com/playlist/4fAHIQhqD4GdaqoCZVrULG?si=crwaw9y-Q-yfqwErXiTqJg</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXZXAHittTWaNgO3uGdvls7">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXZXAHittTWaNgO3uGdvls7</a></li> </ul> <p>3h 59m</p> sbt 1.3.12 https://eed3si9n.com/sbt-1.3.12 Sun, 31 May 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.3.12 <p>I&rsquo;m happy to announce sbt 1.3.12 patch release. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.3.12">https://github.com/sbt/sbt/releases/tag/v1.3.12</a>.</p> <p>Special thanks to Scala Center. It takes time to review bug reports, pull requests, make sure contributions land to the right places, and Scala Center sponsored me to do maintainer tasks for sbt during May. Darja + whole Scala Center crew have been chill to work with.</p> <h3 id="change-since-sbt-1311">Change since sbt 1.3.11</h3> <p>There was a regression in sbt 1.3.11 around the launcher integration, which showed up as <code>repositories</code> file getting ignored. sbt 1.3.12 fixes it. <a href="https://github.com/sbt/sbt/pull/5583">#5583</a></p> sbt 1.3.11 https://eed3si9n.com/sbt-1.3.11 Fri, 29 May 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.3.11 <p>I&rsquo;m happy to announce sbt 1.3.11 patch release. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.3.11">https://github.com/sbt/sbt/releases/tag/v1.3.11</a>.</p> <p>Special thanks to Scala Center. It takes time to review bug reports, pull requests, make sure contributions land to the right places, and Scala Center sponsored me to do maintainer tasks for sbt during May. Darja + whole Scala Center crew have been chill to work with.</p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Normally changing the <code>project/build.properties</code> to</p> Jar Jar Abrams https://eed3si9n.com/jarjar-abrams/ Sun, 24 May 2020 00:00:00 +0000 https://eed3si9n.com/jarjar-abrams/ <p><a href="https://github.com/eed3si9n/jarjar-abrams">Jar Jar Abrams</a> is an <strong>experimental</strong> Scala extension of Jar Jar Links, a utility to shade Java libraries.</p> <p>For library authors, the idea of other library is a double-edged sword. On one hand, using other libraries avoids unnecessary duplication of work, not using other libraries is almost hypocritical. On the other hand, each library you add would add a transitive dependency to your users, increasing the possibility of conflict. This is partly due to the fact that within a single running program you can one have one version of a library.</p> Selective functor in sbt https://eed3si9n.com/selective-functor-in-sbt/ Sat, 16 May 2020 00:00:00 +0000 https://eed3si9n.com/selective-functor-in-sbt/ <p>In <a href="https://www.youtube.com/watch?v=-shamsTC7rQ">sbt core concepts</a> talks I&rsquo;ve been calling sbt a casually functional build tool. Two hallmarks of functional programming are that it uses immutable data structure instead of mutation, and that it gives attention to when and how effects are handled.</p> <h3 id="settings-and-tasks">settings and tasks</h3> <p>From this perspective, we can think of setting expressions and tasks to be those two things:</p> <ul> <li>Settings form an immutable graph in a build.</li> <li>Tasks represent effects.</li> </ul> <p>Anonymous settings are represented using <code>Initialize[A]</code>, which looks like this:</p> keeping promise in sbt https://eed3si9n.com/promise-in-sbt/ Tue, 12 May 2020 00:00:00 +0000 https://eed3si9n.com/promise-in-sbt/ <p>build.sbt is a DSL for defining a task graph to be used for automatic parallel processing. The message passing among the tasks are expressed using <code>something.value</code> macro, which encodes Applicative composition <code>(task1, task2) mapN { case (t1, t2) =&gt; .... }</code>.</p> <p>One mechanism I&rsquo;ve been thinking about is allowing some long-running <code>task1</code> to communicate with <code>task2</code> midway.</p> <p><img alt="promise" src="https://eed3si9n.com/images/promise-01.png"></p> <p>Normally, we would break down <code>task1</code> into two subtasks. But it might not be as straight-forward to implement such thing. For example, how would be tell Zinc to compile something halfway, and resume later? Or tell Coursier to resolve, but fetch later?</p> cached compilation for sbt https://eed3si9n.com/cached-compilation-for-sbt/ Wed, 06 May 2020 00:00:00 +0000 https://eed3si9n.com/cached-compilation-for-sbt/ The notion of cached compilation or remote cache has been around for a while now, but often it required the setup has not been easy. If we can bake build-as-function feature into basic tool chain such as Zinc and sbt, Scala community in general can benefit from it to speed up the build. Even for open source projects, if Travis CI publishes into Bintray or something, the contributors might be able to resume compilation off of the last build. The PR for sbt change is <a href="https://github.com/sbt/sbt/pull/5534">sbt/sbt#5534</a>, and the virtualization change in Zinc is <a href="https://github.com/sbt/zinc/pull/712">sbt/zinc#712</a>. sbt 1.3.10 https://eed3si9n.com/sbt-1.3.10 Wed, 15 Apr 2020 00:00:00 +0000 https://eed3si9n.com/sbt-1.3.10 <p>I&rsquo;m happy to announce sbt 1.3.10 patch release. Full release note is here - <a href="https://github.com/sbt/sbt/releases/tag/v1.3.10">https://github.com/sbt/sbt/releases/tag/v1.3.10</a></p> <h3 id="how-to-upgrade">How to upgrade</h3> <p>Normally changing the <code>project/build.properties</code> to</p> <pre tabindex="0"><code>sbt.version=1.3.10 </code></pre><p>would be ok. However, given that the release may contain fixes to scripts and also because your initial resolution would be faster with <code>*.(zip|tgz|msi)</code> that contains all the JAR files, we recommend you use the installer distribution. They will be available from SDKMAN etc.</p> Zinc 1.4.0-M1 https://eed3si9n.com/zinc-1.4.0-m1 Tue, 14 Apr 2020 00:00:00 +0000 https://eed3si9n.com/zinc-1.4.0-m1 <p>I&rsquo;ve just released Zinc 1.4.0-M1. Note this is a beta release and it won&rsquo;t be compatible with future 1.4.x, but I chose a commit fairly close to 1.3.x so it should be usable.</p> <ul> <li>Cross builds Zinc to Scala 2.12 and 2.13 <a href="https://github.com/sbt/zinc/pull/754">zinc#754</a> by <a href="https://github.com/eed3si9n">@eed3si9n</a></li> <li>Upgrades ScalaPB to 0.9.3 <a href="https://github.com/sbt/zinc/pull/713">zinc#713</a> by <a href="https://github.com/slandelle">@slandelle</a></li> <li>Replaces ZipUtils usage of deprecated <code>java.util.Date</code> with <code>java.time</code> <a href="https://github.com/sbt/zinc/pull/714">zinc#714</a> by <a href="https://github.com/slandelle">@slandelle</a></li> </ul> <p>Zinc is an incremental compiler for Scala. Though Zinc is capable of compiling Scala 2.10 ~ 2.13 and Dotty, thus far Zinc itself has been implemented using Scala 2.12. This is fine for sbt 1.x, which is also implemented in Scala 2.12, but there&rsquo;s been requests to cross build Zinc for 2.13.</p> parallel cross building, part 3 https://eed3si9n.com/parallel-cross-building-part3/ Mon, 13 Apr 2020 00:00:00 +0000 https://eed3si9n.com/parallel-cross-building-part3/ <p>This is part 3 of the post about <a href="https://github.com/sbt/sbt-projectmatrix/">sbt-projectmatrix</a>, an experimental plugin that I&rsquo;ve been working to improve the cross building in sbt. Here&rsquo;s <a href="http://eed3si9n.com/parallel-cross-building-using-sbt-projectmatrix">part 1</a> and <a href="http://eed3si9n.com/parallel-cross-building-with-virtualaxis">part 2</a>. I&rsquo;ve just released 0.5.0.</p> <h3 id="recap-building-against-multiple-scala-versions">recap: building against multiple Scala versions</h3> <p>After adding sbt-projectmatrix to your build, here&rsquo;s how you can set up a matrix with two Scala versions.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.10&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> version <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.1.0-SNAPSHOT&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> core <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>projectMatrix in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;core&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;core&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>jvmPlatform<span style="color:#f92672">(</span>scalaVersions <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;2.12.10&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;2.11.12&#34;</span><span style="color:#f92672">))</span> </span></span></code></pr 6 years at Lightbend https://eed3si9n.com/6years-at-lightbend/ Wed, 08 Apr 2020 00:00:00 +0000 https://eed3si9n.com/6years-at-lightbend/ <p>I joined Lightbend (then Typesafe) in March, 2014. After six incredible years April 7, 2020 was my last day. I am grateful that I got the opportunity to work with an amazing group of people at Lightbend, partners, customers, and various people I got to meet at conferences. Looking back, before COVID-19 times, it&rsquo;s almost surreal that I was flying to Europe, Asia, and North America every few months to attend conferences and tech meetings.</p> user-land compiler warnings in Scala, part 2 https://eed3si9n.com/user-land-compiler-warnings-in-scala-part2/ Sun, 05 Apr 2020 00:00:00 +0000 https://eed3si9n.com/user-land-compiler-warnings-in-scala-part2/ <p><a href="http://eed3si9n.com/user-land-compiler-warnings-in-scala">Last week</a> I wrote about <a href="https://github.com/scala/scala/pull/8820">#8820</a>, my proposal to add user-land compiler warnings in Scala. The example I had was implementing <code>ApiMayChange</code> annotation.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">package</span> foo </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> scala.annotation.apiStatus<span style="color:#f92672">,</span> apiStatus<span style="color:#f92672">.</span><span style="color:#66d9ef">_</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">@apiStatus</span><span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;should DSL is incubating, and future compatibility is not guaranteed&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> category <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Category</span><span style="color:#f92672">.</span><span style="color:#a6e22e">ApiMayChange</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> since <span style="color:#66d9ef">=</span> <span style="color:#e6db74">&#34;foo-lib 1.0&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> defaultAction <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Action</span><span style="color:#f92672">.</span><span style="color:#a6e22e">Warning</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">implicit</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">ShouldDSL</span><span style="color:#f92672">(</span>s<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">String</span><span style="color:#f92672">)</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">def</span> should<span style="color:#f92672">(</span>o<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">String</span><span style="color:#f92672">)</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Unit</span> <span style="color:#f92672">=</span> <span style="color:#f92672">()</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span> </span></span></code></pr bianlu plant-based hotpot https://eed3si9n.com/bianlu-plant-based-hotpot/ Thu, 02 Apr 2020 00:00:00 +0000 https://eed3si9n.com/bianlu-plant-based-hotpot/ <p>serves 4?</p> <h3 id="ingredients">ingredients</h3> <ul> <li>1 head of napa cabbage</li> <li>100 ml of semame oil</li> <li>5 dried shiitake</li> <li>some dried kombu kelp</li> <li>160g vermicelli bean thread</li> <li>frozen meatless meatballs</li> <li>kosher salt</li> <li>chili oil, chili oil with fried garlic, or chili powder</li> <li>(optional) cooked white rice</li> </ul> <h3 id="steps">steps</h3> <ol> <li> <p>put cold water in a large dutch oven with 5 dried shiitake and similar amount of dried kombu kelp. let it sit for a few hours covered.<br> <img src="https://eed3si9n.com/recipes/files/bianlu-step1.jpg"/></p> user-land compiler warnings in Scala https://eed3si9n.com/user-land-compiler-warnings-in-scala/ Sun, 29 Mar 2020 00:00:00 +0000 https://eed3si9n.com/user-land-compiler-warnings-in-scala/ <p>As a library author, I&rsquo;ve been wanting to tag methods in Scala that can trigger custom warnings or compiler errors. Why would I want to intentionally cause a compiler error? One potential use case is displaying a migration message for a removed API.</p> <blockquote class="twitter-tweet"><p lang="en" dir="ltr"> Restligeist macro: n. A macro that fails immediately to display migration message after implementation has been removed from the API.</p>&mdash; ∃ugene yokot∀ (@eed3si9n) <a href="https://twitter.com/eed3si9n/status/770584274819055617?ref_src=twsrc%5Etfw">August 30, 2016</a> </blockquote> <p>For example, if you try to use <code>&lt;&lt;=</code> in sbt 1.3.8 you&rsquo;d get the following error on load:</p> 2020.03 mixtape https://eed3si9n.com/2020.03-mixtape Sun, 01 Mar 2020 00:00:00 +0000 https://eed3si9n.com/2020.03-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/2020-03-500x500.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/0PHmoJCo6yesLCHC1cFaBJ?si=mg6tqCRYTzWxRPLN6wdZlw">https://open.spotify.com/playlist/0PHmoJCo6yesLCHC1cFaBJ?si=mg6tqCRYTzWxRPLN6wdZlw</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVTZp7NrT2vq7Y9npLmn1ty">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVTZp7NrT2vq7Y9npLmn1ty</a></li> </ul> <p>4h 35m</p> equal protection under Eq law https://eed3si9n.com/equal-protection-under-eq-law/ Mon, 10 Feb 2020 00:00:00 +0000 https://eed3si9n.com/equal-protection-under-eq-law/ <p>The relationship given to <code>Int</code> and <code>Long</code> should be exactly the same as the relationship third-party library like Spire can write <code>UInt</code> or <code>Rational</code> with the first-class numeric types.</p> <ul> <li>We should make <code>1 == 1L</code> an error under <code>strictEquality</code></li> <li>We should allow custom types to participate in constant expression conversion using <code>FromDigits</code></li> </ul> liberty, equality, and boxed primitive types https://eed3si9n.com/liberty-equality-and-boxed-primitive-types/ Sun, 02 Feb 2020 00:00:00 +0000 https://eed3si9n.com/liberty-equality-and-boxed-primitive-types/ <p>I want to understand how equality works in Scala. It&rsquo;s a complicated topic that&rsquo;s been going on for ten years.</p> <p>Major concerns are:</p> <ul> <li><code>null</code></li> <li>Unboxed number types</li> <li>Boxed number types</li> <li>Reference types</li> <li>Collections (especially of <code>F[+A]</code>)</li> </ul> <p>Understanding equality means knowing how these combinations are compared.</p> <h3 id="scala-language-specification">Scala Language Specification</h3> <p>The language spec provides some hints, although it does not have the full information. <a href="https://scala-lang.org/files/archive/spec/2.13/12-the-scala-standard-library.html">Chapter 12</a> contains the definition of <code>Any</code> as follows:</p> Giter8 0.12.0 https://eed3si9n.com/giter8-0.12.0 Sun, 08 Dec 2019 00:00:00 +0000 https://eed3si9n.com/giter8-0.12.0 <h3 id="giter8version">giter8.version</h3> <p>I added a small app called giter8-launcher for Giter8 0.12.0. The purpose of the app is to make the behavior of the Giter8 template more predictable. Today, template authors may create a template for some version of Giter8 X, but the users might use some other version of Giter8 Y that ships with &ldquo;sbt new.&rdquo;</p> <p>One of the neat ideas about sbt is that no matter what version of <code>sbt</code> script users might have it installed, the core sbt version is specified by the build author using <code>project/build.properties</code> file. This significantly reduces the it-only-works-on-my-machine problem. giter8-launcher is analogous to sbt&rsquo;s sbt-launcher. giter8-launcher clones the template and reads <code>project/build.properties</code> file to determine the Giter8 version to render the template.</p> <p>Template authors can now specify the Giter8 version in <code>project/build.properties</code> file as:</p> <pre tabindex="0"><code>giter8.version=0.12.0 </code></pre> music for new ark (2019.12 mixtape) https://eed3si9n.com/2019.12-mixtape Sun, 01 Dec 2019 00:00:00 +0000 https://eed3si9n.com/2019.12-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/2EHJoRDsHC7SADeMGP2UDk?si=pgypMooVTQ-sGxQdR6_N2g">https://open.spotify.com/playlist/2EHJoRDsHC7SADeMGP2UDk?si=pgypMooVTQ-sGxQdR6_N2g</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXojw-eMeoubAGXM3mF23SJ">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXojw-eMeoubAGXM3mF23SJ</a></li> </ul> <p>3h 38m</p> parallel cross building with VirtualAxis https://eed3si9n.com/parallel-cross-building-with-virtualaxis/ Mon, 04 Nov 2019 00:00:00 +0000 https://eed3si9n.com/parallel-cross-building-with-virtualaxis/ <p>This is part 2 of the post about <a href="https://github.com/sbt/sbt-projectmatrix/">sbt-projectmatrix</a>, an experimental plugin that I&rsquo;ve been working to improve the cross building in sbt. Here&rsquo;s <a href="http://eed3si9n.com/parallel-cross-building-using-sbt-projectmatrix">part 1</a>. I&rsquo;ve just released 0.4.0.</p> <h3 id="recap-building-against-multiple-scala-versions">recap: building against multiple Scala versions</h3> <p>After adding sbt-projectmatrix to your build, here&rsquo;s how you can set up a matrix with two Scala versions.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.10&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> version <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.1.0-SNAPSHOT&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> core <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>projectMatrix in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;core&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;core&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>jvmPlatform<span style="color:#f92672">(</span>scalaVersions <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;2.12.10&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;2.11.12&#34;</span><span style="color:#f92672">))</span> </span></span></code></pr Pamflet 0.8.2 https://eed3si9n.com/pamflet-082/ Thu, 12 Sep 2019 00:00:00 +0000 https://eed3si9n.com/pamflet-082/ <p><a href="http://www.foundweekends.org/pamflet/">Pamflet</a> is a publishing application for short texts, particularly user documentation of open-source software.</p> <p>Pamflet 0.8.2 updates its monospace typeface to SFMono, and undoes the incidental pink color that got introduced when I migrated from Blueprint to Bootstrap.</p> <img src='https://eed3si9n.com/images/pamflet-0.8.2.png' style='width: 100%;'> future left identity (2019.09 mixtape) https://eed3si9n.com/2019.09-mixtape Fri, 06 Sep 2019 00:00:00 +0000 https://eed3si9n.com/2019.09-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/future-left-identity.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/playlist/6h9uQj829uWehQUuexMMMI?si=WpiDaWnnRpKApATriCutww">https://open.spotify.com/playlist/6h9uQj829uWehQUuexMMMI?si=WpiDaWnnRpKApATriCutww</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotV7ai9WuaxhikdDTXpHuL5-">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotV7ai9WuaxhikdDTXpHuL5-</a></li> </ul> <p>3h 8m</p> sbt 1.3.0 https://eed3si9n.com/sbt-1.3.0 Wed, 04 Sep 2019 00:00:00 +0000 https://eed3si9n.com/sbt-1.3.0 <p>Released <a href="https://www.lightbend.com/blog/sbt-1.3.0-release">sbt 1.3.0</a>.</p> semantics of dependency resolvers https://eed3si9n.com/dependency-resolver-semantics/ Mon, 29 Jul 2019 00:00:00 +0000 https://eed3si9n.com/dependency-resolver-semantics/ <p>The semantics of a dependency resolver determine the concrete classpath based on the user-specified dependency constraints. Typically the differences in the details manifest as different way the version conflicts are resolved.</p> <ul> <li>Maven uses nearest-wins strategy, which could downgrade transitive dependencies</li> <li>Ivy uses latest-wins strategy</li> <li>Coursier generally uses latest-wins strategy, but it&rsquo;s tries to enforce version range strictly</li> <li>Ivy&rsquo;s version range handling goes to the Internet, which makes the build non-repeatable</li> <li>Coursier orders version string completely differently from Ivy</li> </ul> Expecty 0.12.0 and 0.13.0 https://eed3si9n.com/expecty-0120-0130/ Fri, 26 Jul 2019 00:00:00 +0000 https://eed3si9n.com/expecty-0120-0130/ <ul> <li><a href="https://github.com/eed3si9n/expecty/releases/tag/v0.12.0">Expecty 0.12.0</a></li> <li><a href="https://github.com/eed3si9n/expecty/releases/tag/v0.13.0">Expecty 0.13.0</a></li> </ul> sbt core concepts https://eed3si9n.com/sbt-core-concepts/ Wed, 12 Jun 2019 00:00:00 +0000 https://eed3si9n.com/sbt-core-concepts/ <p>I gave a talk at Scala Days 2019 at Lausanne in June.</p> <ul> <li><a href="https://www.youtube.com/watch?v=-shamsTC7rQ">sbt core concepts (YouTube)</a></li> <li><a href="https://www.slideshare.net/EugeneYokota/sbt-core-concepts-scalamatsuri-2019">slides</a></li> </ul> delta vee (2019.06 mixtape) https://eed3si9n.com/2019.06-mixtape Sat, 01 Jun 2019 00:00:00 +0000 https://eed3si9n.com/2019.06-mixtape <img border="0" alt="" src="https://eed3si9n.com/images/delta-vee-600.jpg" width="500" /> <ul> <li>Spotify: <a href="https://open.spotify.com/user/1235450353/playlist/06eEChUrDPYe85JKY5S9Zp?si=KgIJeSqfSUqPRHVPTMzQpA">https://open.spotify.com/user/1235450353/playlist/06eEChUrDPYe85JKY5S9Zp?si=KgIJeSqfSUqPRHVPTMzQpA</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXOukDlQvZn1NVaJv_Ef14j">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotXOukDlQvZn1NVaJv_Ef14j</a></li> </ul> <p>3h 4m</p> parallel cross building using sbt-projectmatrix https://eed3si9n.com/parallel-cross-building-using-sbt-projectmatrix/ Fri, 10 May 2019 00:00:00 +0000 https://eed3si9n.com/parallel-cross-building-using-sbt-projectmatrix/ <p>Last year I wrote an experimental sbt plugin called <a href="https://github.com/sbt/sbt-projectmatrix/">sbt-projectmatrix</a> to improve the cross building in sbt. I&rsquo;ve just released 0.2.0.</p> <h3 id="building-against-multiple-scala-versions">building against multiple Scala versions</h3> <p>After adding sbt-projectmatrix to your build, here&rsquo;s how you can set up a matrix with two Scala versions.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.8&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> version <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.1.0-SNAPSHOT&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> core <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>projectMatrix in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;core&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;core&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>jvmPlatform<span style="color:#f92672">(</span>scalaVersions <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;2.12.8&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;2.11.12&#34;</span><span style="color:#f92672">))</span> </span></span></code></pr splitting git repo https://eed3si9n.com/splitting-git-repo/ Tue, 23 Apr 2019 00:00:00 +0000 https://eed3si9n.com/splitting-git-repo/ <h3 id="split-a-subdirectory-into-a-new-repo-simple-case">split a subdirectory into a new repo (simple case)</h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>git clone --no-hardlinks --branch master originalRepoURL childRepo </span></span><span style="display:flex;"><span>cd childRepo </span></span><span style="display:flex;"><span>git filter-branch --prune-empty --subdirectory-filter path/to/keep master </span></span><span style="display:flex;"><span>git remote remove origin </span></span><span style="display:flex;"><span>git prune </span></span><span style="display:flex;"><span>git gc --aggressive </span></span></code></pre></div><p>Change <code>originalRepoURL</code>, <code>master</code>, and <code>path/to/keep</code> to appropriate values. Use <code>-- --all</code> to handle all branches.</p> <h3 id="split-a-subdirectory-into-a-new-repo-complex-case">split a subdirectory into a new repo (complex case)</h3> <p>In case you have multiple paths you want to filter, you need to use <code>--index-filter</code> together with GNU xargs and GNU sed available via <code>brew install gnu-sed findutils</code>.</p> all your JDKs on Travis CI using SDKMAN! https://eed3si9n.com/all-your-jdks-on-travis-ci-using-sdkman/ Tue, 26 Mar 2019 00:00:00 +0000 https://eed3si9n.com/all-your-jdks-on-travis-ci-using-sdkman/ <p>This is a second post on installing your own JDKs on Travis CI. Previously I&rsquo;ve written about <a href="http://eed3si9n.com/all-your-jdks-on-travis-ci-using-jabba">jabba</a>.</p> <p>Today, let&rsquo;s look at <a href="https://sdkman.io/">SDKMAN!</a>, an environment manager written by Marco Vermeulen (<a href="https://twitter.com/marc0der">@marc0der</a>) for JDKs and various tools on JVM, including Groovy, Spark, sbt, etc.</p> <h3 id="adoptopenjdk-11-and-8">AdoptOpenJDK 11 and 8</h3> <ul> <li><strong>Update 2020-09-23</strong>: Updated the regex of version number.</li> <li><strong>Update 2019-11-06</strong>: Added <code>sdkman_auto_selfupdate</code> to workaround the update prompt blocking the CI. Also it adds <code>|| true</code> on the <code>sdk install</code> line.</li> <li><strong>Update 2019-07-08</strong>: Updated the script to detect patch version. See GitHub for the <a href="https://github.com/eed3si9n/eed3si9n.com/blob/4aeeadaf8b32c4cd8d21afd4d5bdcec7538b0aff/original/all-your-jdks-on-travis-ci-using-sdkman.md">older version</a>.</li> </ul> <p>Here&rsquo;s how we can use SDKMAN! on Travis CI to cross build using AdoptOpenJDK 11 and 8:</p> 2019.03 mixtape https://eed3si9n.com/2019.03-mixtape Mon, 11 Mar 2019 00:00:00 +0000 https://eed3si9n.com/2019.03-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/user/1235450353/playlist/0guisAxA5Q2WO6biLJqdU0?si=ln_WnOvHRaaOZoFImIl5Gw">https://open.spotify.com/user/1235450353/playlist/0guisAxA5Q2WO6biLJqdU0?si=ln_WnOvHRaaOZoFImIl5Gw</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUlIMwWcbtV7FRTEzHqYm_7">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotUlIMwWcbtV7FRTEzHqYm_7</a></li> </ul> <p>2h 58m</p> 'Ancillary Justice' by Ann Leckie https://eed3si9n.com/ancillary-justice/ Sun, 17 Feb 2019 00:00:00 +0000 https://eed3si9n.com/ancillary-justice/ <p><a href="https://www.goodreads.com/book/show/35696749-ancillary-justice" style="float: left; padding-right: 20px"><img border="0" alt="Ancillary Justice (Imperial Radch, #1)" src="https://images.gr-assets.com/books/1500338704m/35696749.jpg" /></a><a href="https://www.goodreads.com/book/show/35696749-ancillary-justice">Ancillary Justice</a> by <a href="https://www.goodreads.com/author/show/3365457.Ann_Leckie">Ann Leckie</a><br> My rating: <a href="https://www.goodreads.com/review/show/2162094397">4 of 5 stars</a></p> <p>&lsquo;Ancillary Justice&rsquo; is written in a first-person narrative as the AI of thousands of years old starship Justice of Toren of The Radchaai Empire. Another interesting part is since the Radchaai language is genderless, the narrator constantly describes everyone as &ldquo;she,&rdquo; but later you might discover that some character might be <i>he</i>. There are other small details here and there that narrator might say, but you start to question it as the story develops. In other words, Ann Leckie has done a stylish job of show-and-not-tell about the world that she&rsquo;s built.</p> sbt on Docker https://eed3si9n.com/sbt-on-docker/ Sun, 17 Feb 2019 00:00:00 +0000 https://eed3si9n.com/sbt-on-docker/ <p>I wanted to run sbt inside Docker, so I created some images. The GitHub repo is <a href="https://github.com/eed3si9n/docker-sbt/">eed3si9n/docker-sbt</a>.</p> Pamflet 0.8.0 https://eed3si9n.com/pamflet-080/ Thu, 03 Jan 2019 00:00:00 +0000 https://eed3si9n.com/pamflet-080/ <p>Over the holiday break I&rsquo;ve implemented left TOC for Pamflet, and released it as <a href="http://www.foundweekends.org/pamflet/">Pamflet 0.8.0</a>.</p> <img src='https://eed3si9n.com/images/pamflet-toc.png' style='width: 100%;'> <p>Pamflet is a publishing application for short texts, particularly user documentation of open-source software.</p> holiday brussel sprouts salad https://eed3si9n.com/brussel-sprouts-salad/ Thu, 27 Dec 2018 00:00:00 +0000 https://eed3si9n.com/brussel-sprouts-salad/ <img src="http://eed3si9n.com/recipes/files/brussel-sprouts-salad.jpg" style="width:100%"/> masking scala.Seq https://eed3si9n.com/masking-scala-seq/ Mon, 17 Dec 2018 00:00:00 +0000 https://eed3si9n.com/masking-scala-seq/ <p>As of Scala 2.13.0-M5, it&rsquo;s planned that <code>scala.Seq</code> will change from <code>scala.collection.Seq</code> to <code>scala.collection.immutable.Seq</code>. <a href="https://www.scala-lang.org/blog/2017/02/28/collections-rework.html#language-integration">Scala 2.13 collections rework</a> explains a bit about why it&rsquo;s been non-immutable historically. Between the lines, I think it&rsquo;s saying that we should celebrate that <code>scala.Seq</code> will now be immutable out of the box.</p> <p>Defaulting to immutable sequence would be good for apps and fresh code. The situation is a bit more complicated for library authors.</p> underhill (2018.12 mixtape) https://eed3si9n.com/2018.12-mixtape Sat, 01 Dec 2018 00:00:00 +0000 https://eed3si9n.com/2018.12-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/user/1235450353/playlist/1cOJUEKtQfCKAovwSZhdyh?si=wc1D4FypQ-2NX0on_eAbNw&fbclid=IwAR3uHVCxo5NQp3fXTWWJbRyLHqbHhSeLaJeS6h-apabvmVHresGB2w_uNAk">https://open.spotify.com/user/1235450353/playlist/1cOJUEKtQfCKAovwSZhdyh?si=wc1D4FypQ-2NX0on_eAbNw&fbclid=IwAR3uHVCxo5NQp3fXTWWJbRyLHqbHhSeLaJeS6h-apabvmVHresGB2w_uNAk</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVgnwc5xG-mE2uiunHANOyY">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVgnwc5xG-mE2uiunHANOyY</a></li> </ul> <p>3 h 28 min</p> making conference a safer space for women https://eed3si9n.com/making-conference-a-safer-space/ Tue, 20 Nov 2018 00:00:00 +0000 https://eed3si9n.com/making-conference-a-safer-space/ <p>We need to change the culture around tech conferences to improve the inclusion of women (and people from other backgrounds too!). For that, there needs to be clear signaling and communication about two basic issues</p> <ol> <li>No, it&rsquo;s not ok to hit on women at a conference.</li> <li>Assume technical competence, and treat women as professional peers. These points should be communicated over and over at each conference before the keynote takes place, and before socializing hours.</li> </ol> 'Red Mars' by Kim Stanley Robinson https://eed3si9n.com/red-mars/ Thu, 01 Nov 2018 00:00:00 +0000 https://eed3si9n.com/red-mars/ <!--break--> <p><a href="https://www.goodreads.com/book/show/35720284-red-mars" style="float: left; padding-right: 20px"><img border="0" alt="Red Mars (Mars Trilogy, #1)" src="https://images.gr-assets.com/books/1500664839m/35720284.jpg" /></a><a href="https://www.goodreads.com/book/show/35720284-red-mars">Red Mars</a> by <a href="https://www.goodreads.com/author/show/1858.Kim_Stanley_Robinson">Kim Stanley Robinson</a><br> My rating: <a href="https://www.goodreads.com/review/show/2162099414">4 of 5 stars</a></p> <p>Red Mars is a science fiction classic written in 1992. This book is everything I wanted and more, starting with first hundred astronauts and cosmonauts migrating to Mars to build the infrastructure such that more people can migrate. By the middle of the book, thousands of people migrate to Mars. The book explores various dimensions the epic project, not just technological challenges, but psychological effects, personality differences, and political interests by superpowers. The geography of Mars is written in vivid, majestic details.</p> super shell for sbt https://eed3si9n.com/super-shell-for-sbt/ Mon, 01 Oct 2018 00:00:00 +0000 https://eed3si9n.com/super-shell-for-sbt/ <p>I&rsquo;ve implemented &ldquo;super shell&rdquo; feature for sbt over the weekend. The idea is to take over the bottom n lines of the termnial, and display the current tasks in progress.</p> <h3 id="the-limitation-of-using-log-as-status-report">the limitation of using log as status report</h3> <p>Logs are useful in many situations, and sometimes it&rsquo;s the only viable tool to find out what&rsquo;s going on. But on a console app like sbt, using logs to tell the build user what&rsquo;s going on doesn&rsquo;t always work.</p> stricter Scala with -Xlint, -Xfatal-warnings, and Scalafix https://eed3si9n.com/stricter-scala-with-xlint-xfatal-warnings-and-scalafix/ Thu, 20 Sep 2018 00:00:00 +0000 https://eed3si9n.com/stricter-scala-with-xlint-xfatal-warnings-and-scalafix/ <p>Compile, or compile not. There&rsquo;s no warning. Two of my favorite Scala compiler flags lately are <code>&quot;-Xlint&quot;</code> and <code>&quot;-Xfatal-warnings&quot;</code>. Here is an example setting that can be used with subprojects:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> version <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.1.0-SNAPSHOT&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.6&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> commonSettings <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> scalacOptions <span style="color:#f92672">++=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-encoding&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;utf8&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-deprecation&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-unchecked&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-Xlint&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-feature&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-language:existentials&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-language:experimental.macros&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-language:higherKinds&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-language:implicitConversions&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-Ypartial-unification&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;-Yrangepos&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">),</span> </span></span><span style="display:flex;"><span> scalacOptions <span style="color:#f92672">++=</span> <span style="color:#f92672">(</span>scalaVersion<span style="color:#f92672">.</span>value <span style="color:#66d9ef">match</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">case</span> <span style="color:#a6e22e">VersionNumber</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#ae81ff">2</span><span style="color:#f92672">,</span> <span style="color:#ae81ff">12</span><span style="color:#f92672">,</span> <span style="color:#66d9ef">_</span><span style="color:#f92672">*),</span> <span style="color:#66d9ef">_</span><span style="color:#f92672">,</span> <span style="color:#66d9ef">_</span><span style="color:#f92672">)</span> <span style="color:#66d9ef">=&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-Xfatal-warnings&#34;</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">case</span> <span style="color:#66d9ef">_</span> <span style="color:#66d9ef">=&gt;</span> <span style="color:#a6e22e">Nil</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">}),</span> </span></span><span style="display:flex;"><span> <span style="color:#a6e22e">Compile</span> <span style="color:#f92672">/</span> console <span style="color:#f92672">/</span> scalacOptions <span style="color:#f92672">--=</span> <span style="color:#a6e22e">Seq</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-deprecation&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;-Xfatal-warnings&#34;</span><span style="color:#f92672">,</span> <span style="color:#e6db74">&#34;-Xlint&#34;</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> foo <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>project in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;foo&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> commonSettings<span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;foo&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span></code></pr git gone: cleaning stale local branches https://eed3si9n.com/git-gone-cleaning-stale-local-branches/ Sat, 15 Sep 2018 00:00:00 +0000 https://eed3si9n.com/git-gone-cleaning-stale-local-branches/ <p>Working with GitHub and pull requests a lot, I end up accumulating stale branches that are no longer needed. In this post, we will look at how to clean the stale local branches.</p> <p>There are mainly two strategies:</p> <ul> <li>Pick a &ldquo;master&rdquo; branch, and delete what&rsquo;s merged to it</li> <li>Assuming branches are deleted first on GitHub, delete local branches that no longer exists on remote &ldquo;origin&rdquo;</li> </ul> <p>Erik Aybar&rsquo;s <a href="http://erikaybar.name/git-deleting-old-local-branches/">Git Tip: Deleting Old Local Branches</a> takes the second approach.</p> xenoanthropology (2018.09 mixtape) https://eed3si9n.com/2018.09-mixtape Fri, 24 Aug 2018 00:00:00 +0000 https://eed3si9n.com/2018.09-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/user/1235450353/playlist/5US2KVLXPDrsB1C3IikMpT?si=yWO4wG-4SEqw-XbsrISlug">https://open.spotify.com/user/1235450353/playlist/5US2KVLXPDrsB1C3IikMpT?si=yWO4wG-4SEqw-XbsrISlug</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVUgp0rFjOJPKyVoFQMEUzo">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVUgp0rFjOJPKyVoFQMEUzo</a></li> </ul> console games in Scala https://eed3si9n.com/console-games-in-scala/ Mon, 20 Aug 2018 00:00:00 +0000 https://eed3si9n.com/console-games-in-scala/ <p>I&rsquo;ve been thinking about rich console applications, the kind of apps that can display things graphically, not just appending lines at the end. Here are some info, enough parts to be able to write Tetris.</p> <h3 id="ansi-x364-control-sequences">ANSI X3.64 control sequences</h3> <p>To display some text at an arbitrary location on a termial screen, we first need to understand what a <em>terminal</em> actually is. In the middle of 1960s, companies started selling minicomputers such as <a href="https://en.wikipedia.org/wiki/PDP-8">PDP-8</a>, and later <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and <a href="https://en.wikipedia.org/wiki/VAX">VAX-11</a>. These were of a size of a refrigerator, purchased by &ldquo;computer labs&rdquo;, and ran operating systems like <a href="https://en.wikipedia.org/wiki/RT-11">RT-11</a> and the original UNIX system that supported up many simultaneous users (12 ~ hundreds?). The users connected to a minicomputer using a physical terminal that looks like a monochrome screen and a keyboard. The classic terminal is <a href="https://en.wikipedia.org/wiki/VT100">VT100</a> that was introduced in 1978 by DEC.</p> all your JDKs on Travis CI using jabba https://eed3si9n.com/all-your-jdks-on-travis-ci-using-jabba/ Mon, 11 Jun 2018 00:00:00 +0000 https://eed3si9n.com/all-your-jdks-on-travis-ci-using-jabba/ <p>Whether you want to try using OpenJDK 11-ea, GraalVM, Eclipse OpenJ9, or you are stuck needing to build using OpenJDK 6, <a href="https://github.com/shyiko/jabba">jabba</a> has got it all. <a href="https://github.com/shyiko/jabba">jabba</a> is a cross-platform Java version manager written by Stanley Shyiko (<a href="https://twitter.com/shyiko">@shyiko</a>).</p> <h3 id="adoptopenjdk-8-and-11">AdoptOpenJDK 8 and 11</h3> <p>Here&rsquo;s how we can use jabba on Travis CI to cross build using AdoptOpenJDK 8 and 11:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">sudo</span>: <span style="color:#66d9ef">false</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">dist</span>: <span style="color:#ae81ff">trusty</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">group</span>: <span style="color:#ae81ff">stable</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">language</span>: <span style="color:#ae81ff">scala</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">scala</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">2.12.7</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">env</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">global</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">JABBA_HOME=/home/travis/.jabba</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">matrix</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">include</span>: </span></span><span style="display:flex;"><span> - <span style="color:#f92672">env</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">[email protected]</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">env</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">[email protected]</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">before_install</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">curl -sL https://raw.githubusercontent.com/shyiko/jabba/0.11.0/install.sh | bash &amp;&amp; . ~/.jabba/jabba.sh</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">install</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$JABBA_HOME/bin/jabba install $TRAVIS_JDK</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">unset _JAVA_OPTIONS</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">export JAVA_HOME=&#34;$JABBA_HOME/jdk/$TRAVIS_JDK&#34; &amp;&amp; export PATH=&#34;$JAVA_HOME/bin:$PATH&#34; &amp;&amp; java -Xmx32m -version</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">script</span>: <span style="color:#ae81ff">sbt -Dfile.encoding=UTF8 -J-XX:ReservedCodeCacheSize=256M ++$TRAVIS_SCALA_VERSION! test</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">before_cache</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">find $HOME/.ivy2 -name &#34;ivydata-*.properties&#34; -delete</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">find $HOME/.sbt -name &#34;*.lock&#34; -delete</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">cache</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">directories</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$HOME/.ivy2/cache</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$HOME/.sbt/boot</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$HOME/.jabba/jdk</span> </span></span></code></pr 2018.06 mixtape https://eed3si9n.com/2018.06-mixtape Fri, 01 Jun 2018 00:00:00 +0000 https://eed3si9n.com/2018.06-mixtape <ul> <li>Spotify: <a href="https://open.spotify.com/user/1235450353/playlist/4jqNCyUylGh9zCYt0JHqEv?si=U1xU9O54Tty7vtAp97KAeA">https://open.spotify.com/user/1235450353/playlist/4jqNCyUylGh9zCYt0JHqEv?si=U1xU9O54Tty7vtAp97KAeA</a></li> <li>YouTube: <a href="https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVoTIXr6OBeLuUSor-PDN_p">https://www.youtube.com/playlist?list=PLSUh6oJ5ZotVoTIXr6OBeLuUSor-PDN_p</a></li> </ul> bringing back power assert with Expecty https://eed3si9n.com/power-assert-with-expecty/ Mon, 28 May 2018 00:00:00 +0000 https://eed3si9n.com/power-assert-with-expecty/ <p>Last week I wrote about <a href="http://eed3si9n.com/hot-source-dependencies-using-sbt-sriracha">using source dependencies with sbt-sriracha</a> for testing purpose. This week we&rsquo;ll look into using Expecty to do power assert.</p> <p>Power assert (or power assertion) is a variant of <code>assert(...)</code> function that that prints out detailed error message automatically. It was originally implemented by Peter Niederwieser (<a href="https://twitter.com/pniederw">@pniederw</a>) for <a href="http://spockframework.org/">Spock</a>, and in 2009 it was merged into <a href="http://groovy-lang.org/releasenotes/groovy-1.7.html#Groovy17releasenotes-PowerAsserts">Groovy 1.7</a>. Power assert has spread to <a href="https://github.com/k-tsj/power_assert">Ruby</a>, <a href="https://github.com/power-assert-js/power-assert">JavaScript</a>, <a href="https://github.com/gifnksm/power-assert-rs">Rust</a>, etc.</p> hot source dependencies using sbt-sriracha https://eed3si9n.com/hot-source-dependencies-using-sbt-sriracha/ Sun, 20 May 2018 00:00:00 +0000 https://eed3si9n.com/hot-source-dependencies-using-sbt-sriracha/ <p>Source dependencies is one of features that existed in sbt since ever, but hasn&rsquo;t been documented well.</p> <h3 id="immutable-source-dependency">immutable source dependency</h3> <p>Here&rsquo;s how to declare source dependency to the latest commit for scopt commandline option parsing library.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> scoptJVMRef <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">ProjectRef</span><span style="color:#f92672">(</span>uri<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;git://github.com/scopt/scopt.git#c744bc48393e21092795059aa925fe50729fe62b&#34;</span><span style="color:#f92672">),</span> <span style="color:#e6db74">&#34;scoptJVM&#34;</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> organization <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;com.example&#34;</span> </span></span><span style="display:flex;"><span><span style="color:#a6e22e">ThisBuild</span> <span style="color:#f92672">/</span> scalaVersion <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2.12.2&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">lazy</span> <span style="color:#66d9ef">val</span> root <span style="color:#66d9ef">=</span> <span style="color:#f92672">(</span>project in file<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;.&#34;</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>dependsOn<span style="color:#f92672">(</span>scoptJVMRef<span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">.</span>settings<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> name <span style="color:#66d9ef">:</span><span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;Hello world&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span></code></pr detecting Java version from Bash https://eed3si9n.com/detecting-java-version-bash/ Fri, 16 Feb 2018 00:00:00 +0000 https://eed3si9n.com/detecting-java-version-bash/ <p>Yesterday I wrote about <a href="http://eed3si9n.com/cross-jvm-testing-travis-ci">cross JVM testing using Travis CI</a>.</p> <h3 id="testing-scala-apps-on-macos-using-travis-ci">testing Scala apps on macOS using Travis CI</h3> <p>Here&rsquo;s how we can test Scala apps on macOS using Travis CI. This is adapted from Lars and Muuki&rsquo;s method: <a href="https://gist.github.com/larsrh/941b72b9b72abe0c1a49">Testing Scala programs with Travis CI on OS X</a></p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">dist</span>: <span style="color:#ae81ff">trusty</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">language</span>: <span style="color:#ae81ff">scala</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">matrix</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">include</span>: </span></span><span style="display:flex;"><span> <span style="color:#75715e">## build using JDK 8, test using JDK 8</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">script</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">sbt universal:packageBin</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">cd citest &amp;&amp; ./test.sh</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jdk</span>: <span style="color:#ae81ff">oraclejdk8</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#75715e">## build using JDK 8, test using JDK 8, on macOS</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">script</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">sbt universal:packageBin</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">cd citest &amp;&amp; ./test.sh</span> </span></span><span style="display:flex;"><span> <span style="color:#75715e">## https://github.com/travis-ci/travis-ci/issues/2316</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">language</span>: <span style="color:#ae81ff">java</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">os</span>: <span style="color:#ae81ff">osx</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">osx_image</span>: <span style="color:#ae81ff">xcode9.2</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#75715e">## build using JDK 8, test using JDK 9</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">script</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">sbt universal:packageBin</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">jdk_switcher use oraclejdk9</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">cd citest &amp;&amp; ./test.sh</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jdk</span>: <span style="color:#ae81ff">oraclejdk8</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#75715e">## build using JDK 8, test using JDK 10</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">script</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">sbt universal:packageBin</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">citest/install-jdk10.sh</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">cd citest &amp;&amp; ./test.sh</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">jdk</span>: <span style="color:#ae81ff">oraclejdk8</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">scala</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">2.10.7</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">before_install</span>: </span></span><span style="display:flex;"><span> <span style="color:#75715e"># https://github.com/travis-ci/travis-ci/issues/8408</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">unset _JAVA_OPTIONS</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">if [[ &#34;$TRAVIS_OS_NAME&#34; = &#34;osx&#34; ]]; then</span> </span></span><span style="display:flex;"><span> <span style="color:#ae81ff">brew update;</span> </span></span><span style="display:flex;"><span> <span style="color:#ae81ff">brew install sbt;</span> </span></span><span style="display:flex;"><span> <span style="color:#ae81ff">fi</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">cache</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">directories</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$HOME/.ivy2/cache</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">$HOME/.sbt/boot</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#f92672">before_cache</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">find $HOME/.ivy2 -name &#34;ivydata-*.properties&#34; -delete</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">find $HOME/.sbt -name &#34;*.lock&#34; -delete</span> </span></span></code></pr cross JVM testing using Travis CI https://eed3si9n.com/cross-jvm-testing-travis-ci/ Thu, 15 Feb 2018 00:00:00 +0000 https://eed3si9n.com/cross-jvm-testing-travis-ci/ <p>Oracle is moving to ship <a href="https://mreinhold.org/blog/forward-faster">non-LTS JDK every 6 months</a>, and LTS JDK every 3 years. Also it&rsquo;s converging to OpenJDK. In this scheme, JDK 9 will be EOL in March 2018; JDK 10 will come out in March 2018, and EOL in September 2018; and LTS JDK 11 that replaces JDK 8 in September 2018 will stay with us until 2021.</p> <p>As we will see quick succession of JDKs in the upcoming months, here&rsquo;s a how-to on testing your app on JDK 8, JDK 9, and JDK 10 Early Access using Travis CI.</p> removing commas with sbt-nocomma https://eed3si9n.com/removing-commas-with-sbt-nocomma/ Sat, 03 Feb 2018 00:00:00 +0000 https://eed3si9n.com/removing-commas-with-sbt-nocomma/ <h3 id="august-2016">August, 2016</h3> <p>During the <a href="https://github.com/scala/docs.scala-lang/pull/533">SIP-27 trailing commas</a> discussion, one of the thoughts that came to my mind was unifiying some of the commas with semicolons, and take advantage of the semicolon inference.</p> <p><a href="https://gitter.im/scala/slip?at=57abcaf6d7087a017faa822a">Aug 10 2016 20:46</a>:</p> <img src='https://eed3si9n.com/images/nocomma1.png' alt="it might be interesting to consider allowing semicolons as vararg separator, and thereby allowing them to be infered as @Ichoran is suggesting"> <p>This doesn&rsquo;t actually work. <a href="https://github.com/Ichoran">@Ichoran</a> kindly pointed out an example:</p> sbt-sticker https://eed3si9n.com/sbt-sticker/ Tue, 30 Jan 2018 00:00:00 +0000 https://eed3si9n.com/sbt-sticker/ <p>As <a href="https://twitter.com/eed3si9n/status/958390142003220480">tweeted</a>, I made some sbt stickers.</p> <img src='https://eed3si9n.com/images/sbt-sticker.jpg' style='width: 100%;'> herding cats: day 17 https://eed3si9n.com/herding-cats-day17/ Fri, 05 Jan 2018 00:00:00 +0000 https://eed3si9n.com/herding-cats-day17/ <p>Wrote <a href="http://eed3si9n.com/herding-cats/day17.html">herding cats: day 17</a> featuring initial and terminal objects, product, duality, and coproduct.</p> <p><img src="http://eed3si9n.com/herding-cats/files/day17-coproducts.png"></p> Coursera machine learning memo https://eed3si9n.com/coursera-machine-learning/ Fri, 29 Dec 2017 00:00:00 +0000 https://eed3si9n.com/coursera-machine-learning/ <p>This holiday break, I somehow got into binge watching Coursera&rsquo;s <a href="https://www.coursera.org/learn/machine-learning/home/welcome">Stanford Machine Learning</a> course taught by Andrew Ng. I remember machine learning to be really math heavy, but I found this one more accessible.</p> <p>Here are some notes for my own use. (I am removing all the fun examples, and making it dry, so if you&rsquo;re interested in machine learning, you should check out the course or its official notes.)</p> sbt server with Neovim https://eed3si9n.com/sbt-server-with-neovim/ Mon, 18 Dec 2017 00:00:00 +0000 https://eed3si9n.com/sbt-server-with-neovim/ <img src="https://eed3si9n.com/images/vim-scala-sbt.gif" border="0" /> encoding file path as URI reference https://eed3si9n.com/encoding-file-path-as-URI-reference/ Tue, 12 Dec 2017 00:00:00 +0000 https://eed3si9n.com/encoding-file-path-as-URI-reference/ <p>In this post I am going to discuss an old new problem of encoding file path as Uniform Resource Identifier (URI) reference.</p> <p>As of 2017, the authoritative source of information is <a href="https://tools.ietf.org/html/rfc8089">RFC 8089 - The &ldquo;file&rdquo; URI Scheme</a> written by Matthew Kerwin.</p> <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">RFC 8089 The &quot;file&quot; URI Scheme <a href="https://t.co/pAIVmQNzCT">https://tools.ietf.org/html/rfc8089 </a> Wow, it actually happened.</p>&mdash; Matthew Kerwin (@phluid61) <a href="https://twitter.com/phluid61/status/832817027576246272?ref_src=twsrc%5Etfw">February 18, 2017</a></blockquote> <p>Future readers might also want to search for &ldquo;file URI scheme RFC&rdquo;, and find the latest version. If you&rsquo;re a programmer, read the RFC. This post is to raise the awareness of the some of the issues around file to URI encoding, but it&rsquo;s not a substitution.</p> sbt server with Sublime Text 3 https://eed3si9n.com/sbt-server-with-sublime-text3/ Fri, 08 Dec 2017 00:00:00 +0000 https://eed3si9n.com/sbt-server-with-sublime-text3/ <p>On <a href="https://developer.lightbend.com/blog/2017-11-30-sbt-1-1-0-RC1-sbt-server/">Tech Hub blog</a> I demonstrated how to use sbt server from VS Code to display compiler errors from a running sbt session. In this post, I&rsquo;ll show how to do that for Sublime Text 3 in this post.</p> <h3 id="setting-up-sublime-text-3-with-sbt-server">setting up Sublime Text 3 with sbt server</h3> <p>First, add <a href="https://github.com/tomv564/LSP">tomv564/LSP</a> plugin to Sublime Text 3.</p> <ol> <li><code>cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages</code></li> <li><code>git clone https://github.com/tomv564/LSP.git</code></li> <li>Run &lsquo;Preferences &gt; Package Control &gt; Satisfy Dependencies&rsquo;</li> </ol> <p>Next, download <a href="https://gist.githubusercontent.com/eed3si9n/0ee26a15218f1d4031b451dd61315d6c/raw/5693fbcafbb9a71f1ac5a9d13ace94df3b091cbc/sbt-server-stdio.js">sbt-server-stdio.js</a> and save it to <code>~/bin/</code> or somewhere you keep scripts. sbt server by default uses Unix domain sockets on POSIX systems and named pipe on Windows, but editors seem to expect stdio. The script is a Node script that&rsquo;s included as our VS Code extension that discovers the socket, and fronts it with stdio.</p> Ergodox https://eed3si9n.com/ergodox/ Mon, 04 Dec 2017 00:00:00 +0000 https://eed3si9n.com/ergodox/ <p>Over the weekend I assembled an Ergodox.</p> <ul> <li>Infinity ErgoDox Ergonomic Keyboard Kit via massdrop</li> <li>Cherry MX Brown switches</li> <li>Datamancer Infinity Ergodox Hardwood Case (Black Walnut / Original) via massdrop</li> <li>Plum Blossom PBT Dye-Subbed Keycap Set (OEM, Blank) via <a href="https://www.massdrop.com/buy/37996">massdrop</a> <img src='https://eed3si9n.com/images/ergodox-2-1920.jpg'></li> </ul> Scala language server using sbt https://eed3si9n.com/scala-language-server-using-sbt/ Tue, 19 Sep 2017 00:00:00 +0000 https://eed3si9n.com/scala-language-server-using-sbt/ <p>It&rsquo;s been a month since sbt 1.0 shipped, and I can finally sit back and think about sbt server again. Using my weekends time, I started hacking on an implementation of Scala language server on top of sbt server.</p> <h3 id="what-is-a-language-server">what is a language server?</h3> <p>A language server is a program that can provide language service to editors like Visual Studio Code, Eclipse Che, and Sublime Text 3 via <a href="https://github.com/Microsoft/language-server-protocol">Language Server Protocol</a>. A typical operation might be <code>textDocument/didOpen</code>, which tells the server that a source file was opened in the editor.</p> Persistent Versioning https://eed3si9n.com/persistent-versioning/ Mon, 21 Aug 2017 00:00:00 +0000 https://eed3si9n.com/persistent-versioning/ <p>In this post, I&rsquo;d like to introduce a version scheme that I call <em>Persistent Versioning</em>. Most of the ideas presented in this post are not new or my own. Let me know if there&rsquo;s already a name for it.</p> <p>In 2015, Jake Wharton (<a href="https://twitter.com/JakeWharton/">@JakeWharton</a>) wrote a blog post titled <a href="http://jakewharton.com/java-interoperability-policy-for-major-version-updates/">Java Interoperability Policy for Major Version Updates</a>:</p> <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">A new policy from <a href="https://twitter.com/jessewilson">@jessewilson</a> and I for the libraries we work on to ensure major version updates are interoperable: <a href="https://t.co/zKqYRwrXmq">https://t.co/zKqYRwrXmq</a></p> auto publish (a website) from Travis-CI https://eed3si9n.com/auto-publish-from-travis-ci/ Wed, 19 Jul 2017 00:00:00 +0000 https://eed3si9n.com/auto-publish-from-travis-ci/ <p>GitHub Pages is a convenient place to host OSS project docs. This post explains how to use Travis CI to deploy your docs automatically on a pull request merge.</p> <h3 id="1-generate-a-fresh-rsa-key-in-some-directory">1. Generate a fresh RSA key in some directory</h3> <p>Make a directory outside of your project first. Pick a key name <code>deploy_yourproject_rsa</code>, so you can distinguish it from other keys.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ mkdir keys </span></span><span style="display:flex;"><span>$ cd keys </span></span><span style="display:flex;"><span>$ ssh-keygen -t rsa -b <span style="color:#ae81ff">4096</span> -C <span style="color:#e6db74">&#34;[email protected]&#34;</span> </span></span><span style="display:flex;"><span>Generating public/private rsa key pair. </span></span><span style="display:flex;"><span>Enter file in which to save the key <span style="color:#f92672">(</span>/Users/xxx/.ssh/id_rsa<span style="color:#f92672">)</span>: deploy_website_rsa </span></span><span style="display:flex;"><span>Enter passphrase <span style="color:#f92672">(</span>empty <span style="color:#66d9ef">for</span> no passphrase<span style="color:#f92672">)</span>: </span></span></code></pr tray for Atreus https://eed3si9n.com/tray-for-atreus/ Sat, 01 Jul 2017 00:00:00 +0000 https://eed3si9n.com/tray-for-atreus/ <p>In the last post that I wrote about Atreus build, I noted that there&rsquo;s an issue of keyboard positioning:</p> <blockquote> <p>Even if I can overcome the layout and memorize the various symbol locations, there&rsquo;s the issue of the placement. If I place the keyboard in between me and the laptop the screen becomes too far.</p> </blockquote> <p>I solved this issue by making a tray for Atreus that I can position it on top of the MacBook Pro keyboard.</p> Atreus https://eed3si9n.com/atreus/ Mon, 19 Jun 2017 00:00:00 +0000 https://eed3si9n.com/atreus/ <p>Last night I finished making my <a href="https://atreus.technomancy.us/">Atreus keyboard</a> from a DYI kit that I got a while back. Here are some of the details:</p> <ul> <li>I chose <a href="http://matias.ca/switches/quiet/">Matias Quiet Click</a> switch option (gray slider). There&rsquo;s no clicking.</li> <li>The modifiers use <a href="http://matias.ca/switches/linear/">Matias Quiet Linear</a> switches (red slider).</li> <li>There are 42 keys in split ortholinear layout.</li> <li>Mahogany ply case.</li> </ul> <h3 id="the-materials">The materials</h3> <p>The kit comes with almost everything you need to assemble the Arteus keyboard. You need lacquer, a soldering iron, solder, and wire cutters.</p> Gigahorse 0.3.0 https://eed3si9n.com/gigahorse-030/ Thu, 27 Apr 2017 00:00:00 +0000 https://eed3si9n.com/gigahorse-030/ <p>Gigahorse 0.3.0 is now released. See <a href="http://eed3si9n.com/gigahorse/">documentation</a> on what it is.</p> <h3 id="okhttp-support">OkHttp support</h3> <p>0.3.0 adds <a href="http://square.github.io/okhttp/">Square OkHttp</a> support. Gigahorse-OkHttp is availble for Scala 2.10, 2.11, and 2.12.</p> <p>According to the JavaDoc you actually don&rsquo;t have to close the <code>OkHttpClient</code> instance.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">import</span> gigahorse._<span style="color:#f92672">,</span> support<span style="color:#f92672">.</span>okhttp<span style="color:#f92672">.</span><span style="color:#a6e22e">Gigahorse</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> gigahorse._ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> support.okhttp.Gigahorse </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">import</span> scala.concurrent._<span style="color:#f92672">,</span> duration<span style="color:#f92672">.</span><span style="color:#66d9ef">_</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> scala.concurrent._ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> duration._ </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">val</span> http <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>http<span style="color:#f92672">(</span><span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>config<span style="color:#f92672">)</span> <span style="color:#75715e">// don&#39;t have to close </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>http<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">gigahorse.HttpClient</span> <span style="color:#f92672">=</span> gigahorse<span style="color:#f92672">.</span>support<span style="color:#f92672">.</span>okhttp<span style="color:#f92672">.</span><span style="color:#a6e22e">OkhClient</span><span style="color:#66d9ef">@</span><span style="color:#ae81ff">23</span>b48158 </span></span></code></pre></div> downloading and running app on the side with sbt-sidedish https://eed3si9n.com/sbt-sidedish/ Mon, 27 Mar 2017 00:00:00 +0000 https://eed3si9n.com/sbt-sidedish/ <p>I&rsquo;ve been asked by a few people on downloading JARs, and then running them from an sbt plugin. Most recently, Shane Delmore (<a href="https://twitter.com/shanedelmore">@shanedelmore</a>) asked me about this at nescala in Brooklyn.</p> <p>During an unconference session I hacked together a demo, and I continued some more after I came home.</p> <h3 id="sbt-sidedish">sbt-sidedish</h3> <p>sbt-sidedish is a toolkit for plugin authors to download and run an app on the side from a plugin. It on its own does not define any plugins.</p> herding cats: day 16 https://eed3si9n.com/herding-cats-day16/ Tue, 21 Mar 2017 00:00:00 +0000 https://eed3si9n.com/herding-cats-day16/ <p>Wrote <a href="http://eed3si9n.com/herding-cats/day16.html">herding cats day 16</a>.</p> Contraband, an alternative to case class https://eed3si9n.com/contraband-an-alternative-to-case-class/ Mon, 06 Mar 2017 00:00:00 +0000 https://eed3si9n.com/contraband-an-alternative-to-case-class/ <p>Here are a few questions I&rsquo;ve been thinking about:</p> <ul> <li>How should I express data or API?</li> <li>How should the data be represented in Java or Scala?</li> <li>How do I convert the data into wire formats such as JSON?</li> <li>How do I evolve the data without breaking binary compatibility?</li> </ul> <h3 id="limitation-of-case-class">limitation of case class</h3> <p>The sealed trait and case class is the idiomatic way to represent datatypes in Scala, but it&rsquo;s impossible to add fields in binary compatible way. Take for example a simple case class <code>Greeting</code>, and see how it would expand into a class and a companion object:</p> Gigahorse 0.2.0 https://eed3si9n.com/gigahorse-020/ Mon, 09 Jan 2017 00:00:00 +0000 https://eed3si9n.com/gigahorse-020/ <p>Gigahorse 0.2.0 is now released. The new change is that it abstracts over two backends. <a href="https://github.com/alexdupre">@alexdupre</a> contributed migration from AHC 1.9 to AHC 2.0, which is based on Netty 4 in <a href="https://github.com/eed3si9n/gigahorse/pull/12">#12</a>.</p> <p>In addition, there&rsquo;s now an experimental Akka HTTP support that I added. <a href="https://github.com/eed3si9n/gigahorse/pull/15">#15</a></p> <p>Please see <a href="http://eed3si9n.com/gigahorse/">Gigahorse docs</a> for the details.</p> gigahorse-github 0.1.0 https://eed3si9n.com/gigahorse-github-010/ Tue, 02 Aug 2016 00:00:00 +0000 https://eed3si9n.com/gigahorse-github-010/ <p><a href="https://github.com/eed3si9n/gigahorse-github">gigahorse-github 0.1.0</a> is released. This is a Gigahorse plugin for Github API v3.</p> Gigahorse 0.1.0 https://eed3si9n.com/gigahorse-010/ Fri, 29 Jul 2016 00:00:00 +0000 https://eed3si9n.com/gigahorse-010/ <blockquote> <p>Update: please use Gigahorse 0.1.1</p> </blockquote> <p>Gigahorse 0.1.0 is now released. It is an HTTP client for Scala with Async Http Client underneath. Please see <a href="http://eed3si9n.com/gigahorse/">Gigahorse docs</a> for the details. Here&rsquo;s an example snippet to get the feel of the library.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">import</span> gigahorse._ </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">import</span> scala.concurrent._<span style="color:#f92672">,</span> duration<span style="color:#f92672">.</span><span style="color:#66d9ef">_</span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>withHttp<span style="color:#f92672">(</span><span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>config<span style="color:#f92672">)</span> <span style="color:#f92672">{</span> http <span style="color:#66d9ef">=&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> r <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>url<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;http://api.duckduckgo.com&#34;</span><span style="color:#f92672">).</span>get<span style="color:#f92672">.</span> </span></span><span style="display:flex;"><span> addQueryString<span style="color:#f92672">(</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;q&#34;</span> <span style="color:#f92672">-&gt;</span> <span style="color:#e6db74">&#34;1 + 1&#34;</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> <span style="color:#e6db74">&#34;format&#34;</span> <span style="color:#f92672">-&gt;</span> <span style="color:#e6db74">&#34;json&#34;</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> f <span style="color:#66d9ef">=</span> http<span style="color:#f92672">.</span>run<span style="color:#f92672">(</span>r<span style="color:#f92672">,</span> <span style="color:#a6e22e">Gigahorse</span><span style="color:#f92672">.</span>asString andThen <span style="color:#f92672">{</span><span style="color:#66d9ef">_</span><span style="color:#f92672">.</span>take<span style="color:#f92672">(</span><span style="color:#ae81ff">60</span><span style="color:#f92672">)})</span> </span></span><span style="display:flex;"><span> <span style="color:#a6e22e">Await</span><span style="color:#f92672">.</span>result<span style="color:#f92672">(</span>f<span style="color:#f92672">,</span> <span style="color:#ae81ff">120.</span>seconds<span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">}</span> </span></span></code></pre></div> registry and reference pattern https://eed3si9n.com/registry-and-reference/ Sun, 03 Jul 2016 00:00:00 +0000 https://eed3si9n.com/registry-and-reference/ <p>There&rsquo;s a &ldquo;pattern&rdquo; that I&rsquo;ve been thinking about, which arises in some situation while persisting/serializing objects.</p> <p>To motivate this, consider the following case class:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">case</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span>name<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">String</span><span style="color:#f92672">,</span> parents<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">List</span><span style="color:#f92672">[</span><span style="color:#66d9ef">User</span><span style="color:#f92672">])</span> </span></span><span style="display:flex;"><span>defined <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">User</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">val</span> alice <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Alice&#34;</span><span style="color:#f92672">,</span> <span style="color:#a6e22e">Nil</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span>alice<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">User</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">())</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">val</span> bob <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Bob&#34;</span><span style="color:#f92672">,</span> alice <span style="color:#66d9ef">:</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Nil</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span>bob<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">User</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Bob</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">())))</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">val</span> charles <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Charles&#34;</span><span style="color:#f92672">,</span> bob <span style="color:#66d9ef">:</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Nil</span><span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span>charles<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">User</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Charles</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Bob</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">())))))</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">val</span> users <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span>alice<span style="color:#f92672">,</span> bob<span style="color:#f92672">,</span> charles<span style="color:#f92672">)</span> </span></span><span style="display:flex;"><span>users<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">List</span><span style="color:#f92672">[</span><span style="color:#66d9ef">User</span><span style="color:#f92672">]</span> <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">()),</span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Bob</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">()))),</span> </span></span><span style="display:flex;"><span> <span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Charles</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Bob</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">User</span><span style="color:#f92672">(</span><span style="color:#a6e22e">Alice</span><span style="color:#f92672">,</span><span style="color:#a6e22e">List</span><span style="color:#f92672">()))))))</span> </span></span></code></pr sjson-new and the prisoner of Azkaban https://eed3si9n.com/sjson-new-and-the-prisoner-of-azkaban/ Mon, 06 Jun 2016 00:00:00 +0000 https://eed3si9n.com/sjson-new-and-the-prisoner-of-azkaban/ <p>This is part 3 on the topic of sjson-new. See also <a href="http://eed3si9n.com/sjson-new">part 1</a> and <a href="http://eed3si9n.com/sjson-new-and-custom-codecs-using-llist">part 2</a>.</p> <p>Within the sbt code base there are a few places where the persisted data is in the order of hundreds of megabytes that I suspect it becomes a performance bottleneck, especially on machines without an SSD drive. Naturally, my first instinct was to start reading up on the encoding of <a href="https://developers.google.com/protocol-buffers/docs/encoding">Google Protocol Buffers</a> to implement my own custom binary format.</p> sjson-new and custom codecs using LList https://eed3si9n.com/sjson-new-and-custom-codecs-using-llist/ Tue, 24 May 2016 00:00:00 +0000 https://eed3si9n.com/sjson-new-and-custom-codecs-using-llist/ <p>Two months ago, I wrote about <a href="http://eed3si9n.com/sjson-new">sjson-new</a>. I was working on that again over the weekend, so here&rsquo;s the update. In the earlier post, I&rsquo;ve introduced the family tree of JSON libraries in Scala ecosystem, the notion of backend independent, typeclass based JSON codec library. I concluded that we need some easy way of defining a custom codec for it to be usable.</p> <h3 id="roll-your-own-shapeless">roll your own shapeless</h3> <p>In between the April post and the last weekend, there were <a href="http://2016.flatmap.no/">flatMap(Oslo) 2016</a> and <a href="http://event.scaladays.org/scaladays-nyc-2016">Scala Days New York 2016</a>. Unfortunately I wasn&rsquo;t able to attend flatMap, but I was able to catch Daniel Spiewak&rsquo;s &ldquo;Roll Your Own Shapeless&rdquo; talk in New York. The full <a href="https://vimeo.com/165837504">flatMap version</a> is available on vimeo, so I recommend you check it out.</p> foundweekends https://eed3si9n.com/foundweekends/ Mon, 11 Apr 2016 00:00:00 +0000 https://eed3si9n.com/foundweekends/ <p>I made a new Github organization called <a href="https://github.com/foundweekends">foundweekends</a> for people who like coding in the weekends. If you want to join, or have project ideas ping me on <a href="https://twitter.com/eed3si9n/status/718906550568534018">twitter</a> or come talk to us on <a href="https://gitter.im/foundweekends/foundweekends">Gitter</a>.</p> <p>As the starter, it will pick up maintenance of <a href="https://github.com/foundweekends/conscript">conscript</a>, <a href="https://github.com/foundweekends/giter8">giter8</a>, and <a href="https://github.com/foundweekends/pamflet">pamflet</a> from <a href="https://twitter.com/n8han">@n8han</a>.</p> sjson-new https://eed3si9n.com/sjson-new/ Mon, 04 Apr 2016 00:00:00 +0000 https://eed3si9n.com/sjson-new/ <h3 id="background">background</h3> <p>One of the fun way of thinking about software projects is literary analysis. Instead of the actual source code, think of who wrote it when and why (what problem does it solve), and how it&rsquo;s written (what influenced it). Within the Scala ecosystem, not too many genre are as rich as the JSON libraries.</p> <p>In December 2008, the first edition of <a href="https://www.artima.com/pins1ed/">Programming in Scala</a> came out, which used JSON as an example in the context of parser combinator, and showed that JSON parser can be written in 10 lines of code:</p> sbt server reboot https://eed3si9n.com/sbt-server-reboot/ Tue, 22 Mar 2016 00:00:00 +0000 https://eed3si9n.com/sbt-server-reboot/ <p>This is a continuation from the <a href="http://eed3si9n.com/sbt-1-roadmap">sbt 1.0 roadmap</a> that I wrote recently. In this post, I&rsquo;m going to introduce a new implementation of sbt server. Please post on <a href="https://groups.google.com/d/msg/sbt-dev/G9iWsx7JlnI/hfHCvD-fCgAJ">sbt-dev mailing list</a> for feedback.</p> <p>The motivation for sbt server is better IDE integration.</p> <blockquote> <p>A build is a giant, mutable, shared, state, device. It&rsquo;s called disk! The build works with disk. You cannot get away from disk.</p> <p>&ndash; Josh Suereth in <a href="https://www.youtube.com/watch?v=Wl8QzsZ4lZk&feature=youtu.be&t=35m30s">The road to sbt 1.0 is paved with server</a></p> </blockquote> <p>The disk on your machine is fundamentally a stateful thing, and sbt can execute the tasks in parallel only because it has the full control of the effects. Any time you are running both sbt and an IDE, or you&rsquo;re running multiple instances of sbt against the same build, sbt <em>cannot</em> guarantee the state of the build.</p> sbt 1.0 roadmap https://eed3si9n.com/sbt-1-roadmap/ Fri, 11 Mar 2016 00:00:00 +0000 https://eed3si9n.com/sbt-1-roadmap/ <p>There’s been some discussions around sbt 1.0 lately, so here is a writeup to discuss it. This document is intended to be a mid-term mission statement. A refocus to get something out. Please post on <a href="https://groups.google.com/d/msg/sbt-dev/PoR7n1ZV_i4/L-Jg6AAABwAJ">sbt-dev mailing list</a> for feedback.</p> <h3 id="timing">Timing</h3> <p>I don’t have a good idea on the timing of when sbt 1.0 will ship. The biggest feature of sbt 1.0 is code reorganization, which is is already in progress: <a href="http://www.scala-sbt.org/0.13/docs/Modularization.html">http://www.scala-sbt.org/0.13/docs/Modularization.html</a></p> ScalaMatsuri as a lifestyle https://eed3si9n.com/scalamatsuri-as-a-lifestyle/ Sat, 13 Feb 2016 00:00:00 +0000 https://eed3si9n.com/scalamatsuri-as-a-lifestyle/ <p>For me (and for many of the 27 organizers, I imagine) ScalaMatsuri is a lifestyle. It&rsquo;s true that there was a successful two-day conference in Tokyo with 550 participants. But for us the organizers, the preparation has been going on since February 28th, for 11 months. Despite the fact that my contribution was small, planning ScalaMatsuri 2016 was by far the most amount of involvement I&rsquo;ve committed to. Through the course of planning months, there were many discussions over Slack, Hangouts, and occasionally even face-to-face. The fun part was coming up with the ideas together, and seeing them materialize. Sometimes, I was the one coming up with radical ideas that were being executed by someone else, while other times, it was the opposite case and I was getting my hands dirty.</p> stricter Scala with -Yno-lub https://eed3si9n.com/stricter-scala-with-ynolub/ Wed, 30 Sep 2015 00:00:00 +0000 https://eed3si9n.com/stricter-scala-with-ynolub/ <p>For a flexible language like Scala, it&rsquo;s useful to think of subset of the programming language, like your own personal Good Parts, and opinionated style guides.</p> <h3 id="setup">setup</h3> <p>To try <code>-Yno-lub</code>, you can drop in the following sbt plugin to <code>project/ynolub.sbt</code>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>addSbtPlugin<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;com.eed3si9n&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;sbt-ynolub&#34;</span> <span style="color:#f92672">%</span> <span style="color:#e6db74">&#34;0.2.0&#34;</span><span style="color:#f92672">)</span> </span></span></code></pre></div><h3 id="lub">lub</h3> <p>When Scala&rsquo;s type inferencer finds type <code>A</code> and type <code>B</code> to unify, it tries to calculate the lub (least upper bounds) of two types with regards to <code>&lt;:&lt;</code>. This process is sometimes called lubbing. Here are some of the examples:</p> herding cats: day 1 https://eed3si9n.com/herding-cats-day1/ Sun, 03 May 2015 00:00:00 +0000 https://eed3si9n.com/herding-cats-day1/ <p>Check out my new series <a href="http://eed3si9n.com/herding-cats/">herding cats</a>. (I&rsquo;m writing it using Pamflet from the get go)</p> <blockquote> <p>This is a log of me going through Cats, a functional programming library for Scala that is currently experimental and under active development.</p> </blockquote> The road to sbt 1.0 is paved with server https://eed3si9n.com/scaladays2015-sf-sbt-talk/ Wed, 22 Apr 2015 00:00:00 +0000 https://eed3si9n.com/scaladays2015-sf-sbt-talk/ <p><img alt="picture" src="https://eed3si9n.com/images/scaladays2015-sf-sbt-talk.png"></p> <p>I gave a talk at Scala Days 2015 San Francisco with Josh Suereth (<a href="https://twitter.com/jsuereth">@jsuereth</a>).</p> <ul> <li><a href="https://www.parleys.com/tutorial/the-road-sbt-1-0-paved-server">video on parlesy.com</a></li> <li><a href="http://www.slideshare.net/EugeneYokota/road-to-sbt-10-paved-with-server">slides</a></li> </ul> switching Java version https://eed3si9n.com/switching-java-version/ Thu, 19 Feb 2015 00:00:00 +0000 https://eed3si9n.com/switching-java-version/ <p>I&rsquo;ve been switching between Mac and Ubuntu, and between Java 6 and 7 lately. This is a memo of how to switch Java versions on both Mac and Ubuntu.</p> <p><strong>Update</strong>: Yoshida-san told me about this thing called <a href="http://www.jenv.be/">jEnv</a>, which does all this.</p> <h3 id="zshrc">Zshrc</h3> <p>Here&rsquo;s one way of loading different shell files depending on the OS:</p> <pre><code>## basic [ -f $HOME/dotfiles/zshrc.basic ] &amp;&amp; source $HOME/dotfiles/zshrc.basic ## aliases [ -f $HOME/dotfiles/zshrc.alias ] &amp;&amp; source $HOME/dotfiles/zshrc.alias case &quot;${OSTYPE}&quot; in # MacOSX darwin*) [ -f $HOME/dotfiles/zshrc.osx ] &amp;&amp; source $HOME/dotfiles/zshrc.osx ;; # Linux linux*) [ -f $HOME/dotfiles/zshrc.linux ] &amp;&amp; source $HOME/dotfiles/zshrc.linux ;; esac ## color [ -f $HOME/dotfiles/zshrc.color ] &amp;&amp; source $HOME/dotfiles/zshrc.color </code></pr monads are fractals https://eed3si9n.com/monads-are-fractals/ Mon, 20 Oct 2014 00:00:00 +0000 https://eed3si9n.com/monads-are-fractals/ <p>On my way back from Uppsala, my mind wandered to a conversation I had with a collegue about the intuition of monads, which I pretty much butchered at the time. As I was mulling this over, it dawned on me.</p> <p><img alt="Sierpinski triangle" src="https://eed3si9n.com/images/200px-Sierpinski_triangle.png"></p> <h3 id="monads-are-fractals">monads are fractals</h3> <p>The above is a fractal called Sierpinski triangle, the only fractal I can remember to draw. Fractals are self-similar structure like the above triangle, in which the parts are similar to the whole (in this case exactly half the scale as parent triangle).</p> <p>Monads are fractals. Given a monadic data structure, its values can be composed to form another value of the data structure. This is why it&rsquo;s useful to programming, and this is why it occurrs in many situations.</p> <p>Let&rsquo;s look at some examples:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span>scala<span style="color:#f92672">&gt;</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">1</span><span style="color:#f92672">),</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">2</span><span style="color:#f92672">,</span> <span style="color:#ae81ff">3</span><span style="color:#f92672">),</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">4</span><span style="color:#f92672">))</span> </span></span><span style="display:flex;"><span>res0<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">List</span><span style="color:#f92672">[</span><span style="color:#66d9ef">List</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Int</span><span style="color:#f92672">]]</span> <span style="color:#66d9ef">=</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">1</span><span style="color:#f92672">),</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">2</span><span style="color:#f92672">,</span> <span style="color:#ae81ff">3</span><span style="color:#f92672">),</span> <span style="color:#a6e22e">List</span><span style="color:#f92672">(</span><span style="color:#ae81ff">4</span><span style="color:#f92672">))</span> </span></span></code></pre></div> towards universal access at a conference https://eed3si9n.com/towards-universal-access-at-a-conference/ Sun, 14 Sep 2014 00:00:00 +0000 https://eed3si9n.com/towards-universal-access-at-a-conference/ <p>Two days of #ScalaMatsuri ended as a huge success. But for the next year, I&rsquo;m leaving ourselves a few homeworks to work on. As the title suggests, the next goal that we should aim for is universal access. In Scala language, universal access principle indicates the fact that both methods and fields can be accessed interchangeably from outside.</p> <p>For a conference, I mean universal access to mean being more inclusive to various groups of people:</p> ScalaMatsuri day1 https://eed3si9n.com/scalamatsuri-day1/ Sat, 13 Sep 2014 00:00:00 +0000 https://eed3si9n.com/scalamatsuri-day1/ <p>This year was the second Scala conference in Japan. We&rsquo;ve changed the name to <a href="http://scalamatsuri.org/en/">ScalaMatsuri</a>, which means Scala festival in Japanese. 300 tickets sold out. With invited guests and free tickets for sponsors, there may have been even more people. The venue was at CyberAgent, which runs blog service and online ad services.</p> <p>Day 1 kicked off with Martin&rsquo;s (<a href="https://twitter.com/odersky">@ordersky</a>) &lsquo;Evolution of Scala.&rsquo; Many people were looking forward to see Martin, so I think it was full house from the get go. During all sessions that I attended, I was busy typing live text translation using my <a href="https://github.com/eed3si9n/closed-captioning">closed-captioning</a> both from English to Japanese, and from Japanese to English along with other members <a href="https://twitter.com/cbirchall">@cbirchall</a>, <a href="https://twitter.com/cdepillabout">@cdepillabout</a>, <a href="https://twitter.com/okapies">@okapies</a>, and <a href="oe_uia">@oe_uia</a>.</p> IRC memo https://eed3si9n.com/irc/ Mon, 25 Aug 2014 00:00:00 +0000 https://eed3si9n.com/irc/ <h2 id="register-your-nick">register your nick</h2> <pre><code>/msg NickServ REGISTER %password% [email protected] </code></pre> <p><a href="http://freenode.net/faq.shtml#nicksetup">What is the recommended way to set up my IRC nickname?</a></p> <h2 id="make-new-channel">make new channel</h2> <p>To check whether a channel has already been registered, use the command:</p> <pre><code>/msg ChanServ info ##channelname /join ##channelname </code></pre> <p>The command to register your channel (once you’ve joined it and you have op status) is as follows:</p> <pre><code>/msg ChanServ register ##channelname </code></pr Vim memo https://eed3si9n.com/vim-memo/ Mon, 26 May 2014 00:00:00 +0000 https://eed3si9n.com/vim-memo/ <p>Personally, I don&rsquo;t mind using SublimeText, which is my editor of choice for a while. But I&rsquo;m also curious about commandline editors since many people taut their ability to code over the network. You could forward X or remote in using some other way and still use Sublime, but let&rsquo;s see how if goes.</p> <p>I started working on this Vim setup when I got a new MBP recently. Figured, I can try something new. So, this post is more of a personal memo written by a total newbie, which is what blogs are all about. caveat emptor. In general though, the configuration is mostly inspired by yuroyoro-san&rsquo;s <a href="http://yuroyoro.hatenablog.com/entry/20120211/1328930819">blog post</a> from a couple years ago.</p> scripting with Scala https://eed3si9n.com/scripting-with-scala/ Sun, 11 May 2014 00:00:00 +0000 https://eed3si9n.com/scripting-with-scala/ <p>The need for regular expressions is real. Whenver I need to transform a set of text files it usually ends up with fumbling through the documentation of <code>find</code> command, zsh, and StackOverflow Perl questions. I would rather use Scala instead of muddling through Perl. It&rsquo;s really the matter of my familiarity than anything else.</p> <p>For example, I now have over a hundred reStructuredText files that I want to convert into markdown. I first tried pandoc, and it looked mostly ok. As I was going through the details, however, I noticed that many of the code literals were not converting over as formatted. This is because they were formatted using either single ticks or using <a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#interpreted-text">Interpreted Text</a>. Preprocessing the text with a series of regex replacements should work.</p> sbt technology preview: auto plugins https://eed3si9n.com/sbt-preview-auto-plugins/ Sat, 29 Mar 2014 00:00:00 +0000 https://eed3si9n.com/sbt-preview-auto-plugins/ <p>See <a href="https://typesafe.com/blog/preview-of-upcoming-sbt-10-features-read-about-the-new-plugins">Preview of upcoming sbt 1.0 features: Read about the new plugins</a> posted on typesafe.com/blog.</p> nescala 2014 day 2: 30 sbt plugins in 15 minutes https://eed3si9n.com/nescala2014day2/ Mon, 03 Mar 2014 00:00:00 +0000 https://eed3si9n.com/nescala2014day2/ <p>Slides from nescala day 2 unconference:</p> <ul> <li><a href="http://eed3si9n.com/30sbt_plugins_in_15min/">30 sbt plugins in 15 minutes</a></li> </ul> <p>I may have added a few more :)</p> learning Scalaz: nescala 2014 https://eed3si9n.com/learning-scalaz-nescala2014/ Sat, 01 Mar 2014 00:00:00 +0000 https://eed3si9n.com/learning-scalaz-nescala2014/ <p>Here are the slide decks and video for learning Scalaz talk:</p> <ul> <li><a href="https://github.com/eed3si9n/learning-scalaz/raw/master/talks/nescala2014_learning_scalaz.pdf">nescala2014_learning_scalaz.pdf</a></li> <li><a href="https://thenewcircle.com/s/post/1578/learning_scalaz_eugene_yokota_video">video of the talk</a></li> </ul> constraining class linearization (mixin order) in Scala https://eed3si9n.com/constraining-class-linearization-in-Scala/ Sun, 22 Dec 2013 00:00:00 +0000 https://eed3si9n.com/constraining-class-linearization-in-Scala/ <p>Woke up early yesterday, so I started skimming <a href="https://twitter.com/xuwei_k">@xuwei_k</a>&rsquo;s <code>override</code> blog post. The topic was so intriguing, I got out of the bed and started translating it as the <a href="http://eed3si9n.com/curious-case-of-putting-override-modifier">curious case of putting override modifier when overriding an abstract method in Scala</a>. In there he describes the conundrum of providing the default instances to typeclasses by using Scalaz codebase as an example.</p> <p>Here&rsquo;s a simplified representation of the problem:</p> curious case of putting override modifier when overriding an abstract method in Scala https://eed3si9n.com/curious-case-of-putting-override-modifier/ Fri, 20 Dec 2013 00:00:00 +0000 https://eed3si9n.com/curious-case-of-putting-override-modifier/ <blockquote> <p>This is a translation of <a href="http://d.hatena.ne.jp/xuwei/20131220/1387509706">Scalaで抽象メソッドをoverrideする際にoverride修飾子を付けるべきかどうかの是非</a> by Kenji Yoshida (<a href="https://twitter.com/xuwei_k">@xuwei_k</a>), a Scalaz committer.</p> </blockquote> <p>First, a quote from Programming in Scala, 2nd ed. p. 192:</p> <blockquote> <p>Scala requires [<code>override</code>] modifier for all members that override a concrete member in a parent class. The modifier is optional if a member implements an abstract member with the same name.</p> </blockquote> <p>In this post, we&rsquo;ll discuss this &ldquo;The modififier is optional.&rdquo; Since overriding an existing method with implementation requires <code>override</code> modifier, and failure to do so would result to a compiler error, there&rsquo;s not much to talk about for that case. We&rsquo;ll focus on whether one should put <code>override</code> modifier or not in the case of overring an abtract method. I don&rsquo;t think there&rsquo;s going to be any difference in Scala version, but let&rsquo;s assume the latest stable 2.10.3.</p> sequencing tasks with sbt-sequential https://eed3si9n.com/sequencing-tasks-with-sbt-sequential/ Sun, 01 Dec 2013 00:00:00 +0000 https://eed3si9n.com/sequencing-tasks-with-sbt-sequential/ <p>In this post, I will discuss the execution semantics and task sequencing in sbt 0.13. First we will cover the background, and then I will introduce a new experimental plugin <code>sbt-sequential</code> that adds sequential tasks.</p> <h2 id="background">background</h2> <p>Mark said:</p> <blockquote> <p>The sbt model is to have your side effects be local to your task so that as long as dependencies are satisfied, the task can be executed whenever. The win is parallel by default and enabling faster builds in practice.</p> traveling through the 4th dimension with sbt 0.13 https://eed3si9n.com/4th-dimension-with-sbt-013/ Mon, 07 Oct 2013 00:00:00 +0000 https://eed3si9n.com/4th-dimension-with-sbt-013/ <p>Warning: This is a memo about sbt for intermediate users.</p> <h3 id="setting-system">setting system</h3> <p>At the heart of sbt 0.13 is the setting system, just like sbt 0.12. Let&rsquo;s look at <a href="https://github.com/sbt/sbt/blob/541375cde65635a7d2c6132d1ed96aaaefb38466/util/collection/src/main/scala/sbt/Settings.scala#L414">Settings.scala</a>:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">trait</span> <span style="color:#a6e22e">Init</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Scope</span><span style="color:#f92672">]</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">final</span> <span style="color:#66d9ef">case</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">ScopedKey</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">](</span> </span></span><span style="display:flex;"><span> scope<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Scope</span><span style="color:#f92672">,</span> </span></span><span style="display:flex;"><span> key<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">AttributeKey</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">])</span> <span style="color:#66d9ef">extends</span> <span style="color:#a6e22e">KeyedInitialize</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">]</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">}</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">sealed</span> <span style="color:#66d9ef">trait</span> <span style="color:#a6e22e">Initialize</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">]</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">def</span> dependencies<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Seq</span><span style="color:#f92672">[</span><span style="color:#66d9ef">ScopedKey</span><span style="color:#f92672">[</span><span style="color:#66d9ef">_</span><span style="color:#f92672">]]</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">def</span> evaluate<span style="color:#f92672">(</span>map<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Settings</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Scope</span><span style="color:#f92672">])</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">T</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">}</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">sealed</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Setting</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">]</span> <span style="color:#a6e22e">private</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Init</span><span style="color:#f92672">](</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> key<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">ScopedKey</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">],</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> init<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Initialize</span><span style="color:#f92672">[</span><span style="color:#66d9ef">T</span><span style="color:#f92672">],</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> pos<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">SourcePosition</span><span style="color:#f92672">)</span> <span style="color:#66d9ef">extends</span> <span style="color:#a6e22e">SettingsDefinition</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">}</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span> </span></span></code></pr what is object-oriented programming? https://eed3si9n.com/oop/ Wed, 18 Sep 2013 00:00:00 +0000 https://eed3si9n.com/oop/ <p>How do you define oop?</p> <h2 id="purely-object-oriented-programming">purely object-oriented programming</h2> <p>Purely object-oriented programming is defined to be:</p> <blockquote> <p>programming with objects.</p> </blockquote> <p>What&rsquo;s an object?</p> <blockquote> <p>It is an atom that can hold references to other objects, receive predefined list of messages, and send messages to other objects and itself; and nothing else. A message consists of a name and a list of reference to objects.</p> </blockquote> <p>This is it. The wording is mine, but the idea is from <a href="http://www.purl.org/stefan_ram/pub/doc_kay_oop_en">Alan Kay</a> (2003), the guy who coined the term object-oriented programming. Anything else is either not directly tied to oop or an implementation detail.</p> sbt-logo proposal https://eed3si9n.com/sbt-logo/ Sat, 24 Aug 2013 00:00:00 +0000 https://eed3si9n.com/sbt-logo/ <!--break--> <p>See <a href="https://groups.google.com/d/msg/sbt-dev/X2kcjAvFlJE/zIlVD0wmlrgJ">sbt-logo proposals</a> thread on sbt-dev and <a href="https://groups.google.com/d/msg/simple-build-tool/7_C1IPrIp2w/Mt7hfd03PWIJ">the original thread</a> on sbt. The source is at <a href="https://github.com/eed3si9n/sbt-logo">eed3si9n/sbt-logo</a>.</p> <p>Edit: Changed the tail of &rsquo;t&rsquo;. See github for the original.</p> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Exo:300,400,600,700" type="text/css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Quicksand:300,400,600,700" type="text/css"> <style> .main-black { background-color: rgb(0, 0, 0); /* color: rgb(239, 110, 37); */ color: white; font-family: Exo, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 21px; padding: 10px 20px; } .main { background-image: url('http://www.scala-sbt.org/release/docs/_static/dark-blue-bg.png'); color: white; font-family: Exo, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 21px; padding: 10px 20px; } .main2 { background-color: rgb(242, 242, 235); color: rgb(13, 36, 40); font-family: Exo, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 21px; padding: 10px 20px; } .tagline { font-size: 50px; margin-left: 20px; margin-top: -10px; font-weight: bold; } </style> <div class="main-black"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-orange-50x30.png" style="margin-bottom: 5px;" /> .sbt build definition </div> <br> <div class="main-black"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-orange-100x60.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main-black"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-orange-200x120.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main-black"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-orange-600x360.png" /><br> <div class="tagline">&gt; ~compile<br><br> </div> </div> <br> <div class="main"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-white-50x30.png" style="margin-bottom: 5px;" /> .sbt build definition </div> <br> <div class="main"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-white-100x60.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-white-200x120.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-white-600x360.png" /> <div class="tagline">&gt; ~compile<br><br> </div> </div> <br> <div class="main2"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-black-50x30.png" style="margin-bottom: 5px;" /> .sbt build definition </div> <br> <div class="main2"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-black-100x60.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main2"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-black-200x120.png" style="margin-bottom: 5px;" /> sbt is a build tool for Scala and Java projects that aims to do the basics well. </div> <br> <div class="main2"> <img src="http://eed3si9n.github.io/sbt-logo/2013/sbt-logo-black-600x360.png" /> <div class="tagline">&gt; ~compile<br><br> </div> </div> Scala: the flying sandwich parts https://eed3si9n.com/scala-the-flying-sandwich-parts/ Thu, 20 Jun 2013 00:00:00 +0000 https://eed3si9n.com/scala-the-flying-sandwich-parts/ <p>JavaScript existed since 1995 long before &lsquo;JavaScript: The Good Parts&rsquo; (2008), jQuery (2006), and V8 (2008) happened. The interesting thing about Douglas Crockford&rsquo;s &lsquo;The Good Parts&rsquo; is that unlike the other additive work, it&rsquo;s a book about subtracting features from the language.</p> <p>I&rsquo;ve been thinking about exploring a subset of Scala in a wonderland setting without the &ldquo;real world&rdquo; constraints such as Java familiarity and interoperability. If using Scala as an alternative Java is acceptable, why not try using it as an alternative functional programming language? Another point of this thought experiment is to see some of the duplicate constructs can be reduced. In this article, I&rsquo;m not interested in finding out the idiomatic way, or calling something good or bad. I&rsquo;m calling this The Flying Sandwich Parts (TFSP).</p> scopt 3.0 https://eed3si9n.com/scopt3/ Sun, 09 Jun 2013 00:00:00 +0000 https://eed3si9n.com/scopt3/ <blockquote> <p>scopt is a little command line options parsing library.</p> </blockquote> <p>Today, I&rsquo;m releasing scopt 3.0. If you&rsquo;re not interested in the implementation details, skip to the <a href="https://github.com/scopt/scopt">readme</a>.</p> <p>Around March 4th, 2010, I became a committer to scopt, a fork of Aaron Harnly&rsquo;s scala-options that was written in 2008. I think I wanted to make a few changes around the usage text, key=value options, and argument list. Since then I&rsquo;ve been fielding all the bug reports, including the request to publish the jar on scala-tools.org. On March 18, 2012, I forked the project again to <a href="https://github.com/scopt/scopt">scopt/scopt</a> and released scopt 2.0.0 that added immutable parser.</p> how to write a Dispatch plugin https://eed3si9n.com/howto-write-a-dispatch-plugin/ Sat, 11 May 2013 00:00:00 +0000 https://eed3si9n.com/howto-write-a-dispatch-plugin/ <p>Dispatch has been the de facto library to get to the Internet from Scala. To keep in step with the recent move towards non-blocking IO, <a href="https://twitter.com/n8han">@n8han</a> rewrote the library as Reboot based on <a href="http://sonatype.github.io/async-http-client/">Async Http Client</a>. This became Dispatch 0.9. Then Dispatch 0.10 came out to replace its own <code>Promise</code> type with the standarized SIP-14 <code>Future</code>.</p> <p>As with Dispatch Classic, Reboot lets you write plugins to wrap around web APIs. In this post we&rsquo;ll port a plugin from Classic to explore how it works.</p> <p><img alt="working on your own twitter bot?" src="http://eed3si9n.com/images/twitter_bot.png"></p> Notes on 'Monads Are Not Metaphors' https://eed3si9n.com/notes-on-monads-are-not-metaphors/ Mon, 06 May 2013 00:00:00 +0000 https://eed3si9n.com/notes-on-monads-are-not-metaphors/ <blockquote> <p>This is a translation of <a href="http://d.hatena.ne.jp/xuwei/20130505/1367742286">「モナドはメタファーではない」に関する補足</a> by Kenji Yoshida (<a href="https://twitter.com/xuwei_k">@xuwei_k</a>), one of the most active Scala bloggers in Japan covering wide range of topics from Play to Scalaz.</p> </blockquote> <p>Daniel Spiewak&rsquo;s <a href="http://www.codecommit.com/blog/ruby/monads-are-not-metaphors">Monads Are Not Metaphors</a> was written about two and a half years ago, but seeing how its <a href="http://eed3si9n.com/ja/monads-are-not-metaphors">Japanese translation</a> is still being tweeted and being bookmarked by 250 users on <a href="http://b.hatena.ne.jp/entry/eed3si9n.com/ja/monads-are-not-metaphors">Hantena</a>, its popularity doesn&rsquo;t seem to cease. I just remembered something to note about the example code used in the post, which could be an unstylish critique, but I&rsquo;m going to jot it down here. It&rsquo;s an <em>unstylish critique</em>, because I&rsquo;ll be digging into the part where <em>the author likely knew from the beginning but omitted it intentionally for the sake of illustration</em>. Also I&rsquo;ll be using Scalaz in this post.</p> translating a conference https://eed3si9n.com/translating-a-conference/ Tue, 02 Apr 2013 00:00:00 +0000 https://eed3si9n.com/translating-a-conference/ <p>It&rsquo;s been a month now, but on March 1, 2013 I flew to Japan to attend &ldquo;Scala Conference in Japan 2013.&rdquo; That&rsquo;s the name of the conference.</p> <h3 id="from-a-podcast">from a podcast</h3> <p>One day (June 2, 2012), I was listening to Scala Types recorded at Scala Days 2012, and someone (turns out it&rsquo;s @timperrett) said &ldquo;I would love to see Scala Days in Asia. We had two in Europe now. It would be wicked to have it in China or Japan, or somewhere like that.&rdquo; I relayed this info on twitter saying there&rsquo;s an opportunity for the Scala community in Japan to invite the conference.</p> sudoku using Func https://eed3si9n.com/sudoku-using-func/ Wed, 05 Dec 2012 00:00:00 +0000 https://eed3si9n.com/sudoku-using-func/ <blockquote> <p>This is the 5th entry of <a href="http://partake.in/events/7211abc9-ebb8-4670-b912-3089dc5e0edd">Scalaz Advent Calendar 2012</a>.</p> </blockquote> <p>During the months of December, tech-savvy geeks in Japan take turns to post themed blog articles, known as the &ldquo;Advent Calendar&rdquo;. For last year&rsquo;s <a href="http://partake.in/events/33870915-f25b-40b6-9456-b898b898d48b">Scala Advent Calendar 2011</a> I <a href="http://eed3si9n.com/ja/essence-of-iterator-pattern">translated</a> Eric Torreborre&rsquo;s post covering <a href="http://etorreborre.blogspot.com/2011/06/essence-of-iterator-pattern.html">The Essence of Iterator Pattern</a>. It was somewhat of a calculated move, knowing Japanese fondness for functional programming articles. Another selfish motive was that some of the concept would seep in to my thickness as I was translating the post word by word. In hindsight, both goals were achieved handsomely thanks to the quality of both Jeremy Gibbons, Bruno Oliveira and Eric&rsquo;s work. This seeped in knowledge was probably the secret sauce behind the learning Scalaz series that I worked on this year.</p> Scalaz cheat sheet https://eed3si9n.com/scalaz-cheat-sheet/ Sat, 01 Sep 2012 00:00:00 +0000 https://eed3si9n.com/scalaz-cheat-sheet/ <table width="100%" class="cheatsheet"> <tr> <td width="50%" valign="top"> <div markdown="1" class="cheatsheet"> ### Equal[A] ```scala def equal(a1: A, a2: A): Boolean (1 === 2) assert_=== false (2 =/= 1) assert_=== true ``` </div> <div markdown="1" class="cheatsheet"> ### Order[A] ```scala def order(x: A, y: A): Ordering 1.0 ?|? 2.0 assert_=== Ordering.LT 1.0 lt 2.0 assert_=== true 1.0 gt 2.0 assert_=== false 1.0 lte 2.0 assert_=== true 1.0 gte 2.0 assert_=== false 1.0 max 2.0 assert_=== 2.0 1.0 min 2.0 assert_=== 1.0 ``` </div> <div markdown="1" class="cheatsheet"> ### Show[A] ```scala def show(f: A): Cord 1.0.show assert_=== Cord("1.0") 1.0.shows assert_=== "1.0" 1.0.print assert_=== () 1.0.println assert_=== () ``` </div> <div markdown="1" class="cheatsheet"> ### Enum[A] extends Order[A] ```scala def pred(a: A): A def succ(a: A): A 1.0 |-> 2.0 assert_=== List(1.0, 2.0) 1.0 |--> (2, 5) assert_=== List(1.0, 3.0, 5.0) // |=>/|==>/from/fromStep return EphemeralStream[A] (1.0 |=> 2.0).toList assert_=== List(1.0, 2.0) (1.0 |==> (2, 5)).toList assert_=== List(1.0, 3.0, 5.0) (1.0.from take 2).toList assert_=== List(1.0, 2.0) ((1.0 fromStep 2) take 2).toList assert_=== List(1.0, 3.0) 1.0.pred assert_=== 0.0 1.0.predx assert_=== Some(0.0) 1.0.succ assert_=== 2.0 1.0.succx assert_=== Some(2.0) 1.0 -+- 1 assert_=== 2.0 1.0 --- 1 assert_=== 0.0 Enum[Int].min assert_=== Some(-2147483648) Enum[Int].max assert_=== Some(2147483647) ``` </div> <div markdown="1" class="cheatsheet"> ### Semigroup[A] ```scala def append(a1: A, a2: => A): A List(1, 2) |+| List(3) assert_=== List(1, 2, 3) List(1, 2) mappend List(3) assert_=== List(1, 2, 3) 1 |+| 2 assert_=== 3 (Tags.Multiplication(2) |+| Tags.Multiplication(3): Int) assert_=== 6 // Tags.Disjunction (||), Tags.Conjunction (&&) (Tags.Disjunction(true) |+| Tags.Disjunction(false): Boolean) assert_=== true (Tags.Conjunction(true) |+| Tags.Conjunction(false): Boolean) assert_=== false (Ordering.LT: Ordering) |+| (Ordering.GT: Ordering) assert_=== Ordering.LT (none: Option[String]) |+| "andy".some assert_=== "andy".some (Tags.First('a'.some) |+| Tags.First('b'.some): Option[Char]) assert_=== 'a'.some (Tags.Last('a'.some) |+| Tags.Last(none: Option[Char]): Option[Char]) assert_=== 'a'.some ``` </div> <div markdown="1" class="cheatsheet"> ### Monoid[A] extends Semigroup[A] ```scala def zero: A mzero[List[Int]] assert_=== Nil ``` </div> <div markdown="1" class="cheatsheet"> ### Functor[F[_]] ```scala def map[A, B](fa: F[A])(f: A => B): F[B] List(1, 2, 3) map {_ + 1} assert_=== List(2, 3, 4) List(1, 2, 3) ∘ {_ + 1} assert_=== List(2, 3, 4) List(1, 2, 3) >| "x" assert_=== List("x", "x", "x") List(1, 2, 3) as "x" assert_=== List("x", "x", "x") List(1, 2, 3).fpair assert_=== List((1,1), (2,2), (3,3)) List(1, 2, 3).strengthL("x") assert_=== List(("x",1), ("x",2), ("x",3)) List(1, 2, 3).strengthR("x") assert_=== List((1,"x"), (2,"x"), (3,"x")) List(1, 2, 3).void assert_=== List((), (), ()) Functor[List].lift {(_: Int) * 2} (List(1, 2, 3)) assert_=== List(2, 4, 6) ``` </div> <div markdown="1" class="cheatsheet"> ### Pointed[F[_]] extends Functor[F] ```scala def point[A](a: => A): F[A] 1.point[List] assert_=== List(1) 1.η[List] assert_=== List(1) ``` </div> <div markdown="1" class="cheatsheet"> ### Apply[F[_]] extends Functor[F] ```scala def ap[A,B](fa: => F[A])(f: => F[A => B]): F[B] 1.some <*> {(_: Int) + 2}.some assert_=== Some(3) // except in 7.0.0-M3 1.some <*> { 2.some <*> {(_: Int) + (_: Int)}.curried.some } assert_=== 3.some 1.some <* 2.some assert_=== 1.some 1.some *> 2.some assert_=== 2.some Apply[Option].ap(9.some) {{(_: Int) + 3}.some} assert_=== 12.some Apply[List].lift2 {(_: Int) * (_: Int)} (List(1, 2), List(3, 4)) assert_=== List(3, 4, 6, 8) (3.some |@| 5.some) {_ + _} assert_=== 8.some // ^(3.some, 5.some) {_ + _} assert_=== 8.some ``` </div> <div markdown="1" class="cheatsheet"> ### Applicative[F[_]] extends Apply[F] with Pointed[F] ```scala // no contract function ``` </div> <div markdown="1" class="cheatsheet"> ### Product/Composition ```scala (Applicative[Option] product Applicative[List]).point(0) assert_=== (0.some, List(0)) (Applicative[Option] compose Applicative[List]).point(0) assert_=== List(0).some ``` </div> <div markdown="1" class="cheatsheet"> ### Bind[F[_]] extends Apply[F] ```scala def bind[A, B](fa: F[A])(f: A => F[B]): F[B] 3.some flatMap { x => (x + 1).some } assert_=== 4.some (3.some >>= { x => (x + 1).some }) assert_=== 4.some 3.some >> 4.some assert_=== 4.some List(List(1, 2), List(3, 4)).join assert_=== List(1, 2, 3, 4) ``` </div> <div markdown="1" class="cheatsheet"> ### Monad[F[_]] extends Applicative[F] with Bind[F] ```scala // no contract function // failed pattern matching produces None (for {(x :: xs) <- "".toList.some} yield x) assert_=== none (for { n <- List(1, 2); ch <- List('a', 'b') } yield (n, ch)) assert_=== List((1, 'a'), (1, 'b'), (2, 'a'), (2, 'b')) (for { a <- (_: Int) * 2; b <- (_: Int) + 10 } yield a + b)(3) assert_=== 19 List(1, 2) filterM { x => List(true, false) } assert_=== List(List(1, 2), List(1), List(2), List()) ``` </div> <div markdown="1" class="cheatsheet"> ### Plus[F[_]] ```scala def plus[A](a: F[A], b: => F[A]): F[A] List(1, 2) <+> List(3, 4) assert_=== List(1, 2, 3, 4) ``` </div> <div markdown="1" class="cheatsheet"> ### PlusEmpty[F[_]] extends Plus[F] ```scala def empty[A]: F[A] (PlusEmpty[List].empty: List[Int]) assert_=== Nil ``` </div> <div markdown="1" class="cheatsheet"> ### ApplicativePlus[F[_]] extends Applicative[F] with PlusEmpty[F] ```scala // no contract function ``` </div> <div markdown="1" class="cheatsheet"> ### MonadPlus[F[_]] extends Monad[F] with ApplicativePlus[F] ```scala // no contract function List(1, 2, 3) filter {_ > 2} assert_=== List(3) ``` </div> <div markdown="1" class="cheatsheet"> ### Foldable[F[_]] ```scala def foldMap[A,B](fa: F[A])(f: A => B)(implicit F: Monoid[B]): B def foldRight[A, B](fa: F[A], z: => B)(f: (A, => B) => B): B List(1, 2, 3).foldRight (0) {_ + _} assert_=== 6 List(1, 2, 3).foldLeft (0) {_ + _} assert_=== 6 (List(1, 2, 3) foldMap {Tags.Multiplication}: Int) assert_=== 6 List(1, 2, 3).foldLeftM(0) { (acc, x) => (acc + x).some } assert_=== 6.some ``` </div> <div markdown="1" class="cheatsheet"> ### Traverse[F[_]] extends Functor[F] with Foldable[F] ```scala def traverseImpl[G[_]:Applicative,A,B](fa: F[A])(f: A => G[B]): G[F[B]] List(1, 2, 3) traverse { x => (x > 0) option (x + 1) } assert_=== List(2, 3, 4).some List(1, 2, 3) traverseU {_ + 1} assert_=== 9 List(1.some, 2.some).sequence assert_=== List(1, 2).some 1.success[String].leaf.sequenceU map {_.drawTree} assert_=== "1\n".success[String] ``` </div> <div markdown="1" class="cheatsheet"> ### Length[F[_]] ```scala def length[A](fa: F[A]): Int List(1, 2, 3).length assert_=== 3 ``` </div> <div markdown="1" class="cheatsheet"> ### Index[F[_]] ```scala def index[A](fa: F[A], i: Int): Option[A] List(1, 2, 3) index 2 assert_=== 3.some List(1, 2, 3) index 3 assert_=== none ``` </div> <div markdown="1" class="cheatsheet"> ### ArrId[=>:[_, _]] ```scala def id[A]: A =>: A ``` </div> <div markdown="1" class="cheatsheet"> ### Compose[=>:[_, _]] ```scala def compose[A, B, C](f: B =>: C, g: A =>: B): (A =>: C) val f1 = (_:Int) + 1 val f2 = (_:Int) * 100 (f1 >>> f2)(2) assert_=== 300 (f1 <<< f2)(2) assert_=== 201 ``` </div> <div markdown="1" class="cheatsheet"> ### Category[=>:[_, _]] extends ArrId[=>:] with Compose[=>:] ```scala // no contract function ``` </div> <div markdown="1" class="cheatsheet"> ### Arrow[=>:[_, _]] extends Category[=>:] ```scala def arr[A, B](f: A => B): A =>: B def first[A, B, C](f: (A =>: B)): ((A, C) =>: (B, C)) val f1 = (_:Int) + 1 val f2 = (_:Int) * 100 (f1 *** f2)(1, 2) assert_=== (2, 200) (f1 &&& f2)(1) assert_=== (2,100) ``` </div> <div markdown="1" class="cheatsheet"> ### Unapply[TC[`_`[`_`]], MA] ```scala type M[_] type A def TC: TC[M] def apply(ma: MA): M[A] implicitly[Unapply[Applicative, Int => Int]].TC.point(0).asInstanceOf[Int => Int](10) assert_=== Applicative[({type l[x]=Function1[Int, x]})#l].point(0)(10) List(1, 2, 3) traverseU {(x: Int) => {(_:Int) + x}} apply 1 assert_=== List(2, 3, 4) // traverse won't work ``` </div> </td> <!-- data types --> <td width="50%" valign="top"> <div markdown="1" class="cheatsheet"> ### Boolean ```scala false /\ true assert_=== false // && false \/ true assert_=== true // || (1 < 10) option 1 assert_=== 1.some (1 > 10)? 1 | 2 assert_=== 2 (1 > 10)?? {List(1)} assert_=== Nil ``` </div> <div markdown="1" class="cheatsheet"> ### Option ```scala 1.some assert_=== Some(1) none[Int] assert_=== (None: Option[Int]) 1.some? 'x' | 'y' assert_=== 'x' 1.some | 2 assert_=== 1 // getOrElse ``` </div> <div markdown="1" class="cheatsheet"> ### Id[+A] = A ```scala // no contract function 1 + 2 + 3 |> {_ * 6} 1 visit { case x@(2|3) => List(x * 2) } ``` </div> <div markdown="1" class="cheatsheet"> ### Tagged[A] ```scala sealed trait KiloGram def KiloGram[A](a: A): A @@ KiloGram = Tag[A, KiloGram](a) def f[A](mass: A @@ KiloGram): A @@ KiloGram ``` </div> <div markdown="1" class="cheatsheet"> ### Tree[A]/TreeLoc[A] ```scala val tree = 'A'.node('B'.leaf, 'C'.node('D'.leaf), 'E'.leaf) (tree.loc.getChild(2) >>= {_.getChild(1)} >>= {_.getLabel.some}) assert_=== 'D'.some (tree.loc.getChild(2) map {_.modifyLabel({_ => 'Z'})}).get.toTree.drawTree assert_=== 'A'.node('B'.leaf, 'Z'.node('D'.leaf), 'E'.leaf).drawTree ``` </div> <div markdown="1" class="cheatsheet"> ### Stream[A]/Zipper[A] ```scala (Stream(1, 2, 3, 4).toZipper >>= {_.next} >>= {_.focus.some}) assert_=== 2.some (Stream(1, 2, 3, 4).zipperEnd >>= {_.previous} >>= {_.focus.some}) assert_=== 3.some (for { z <- Stream(1, 2, 3, 4).toZipper; n1 <- z.next } yield { n1.modify {_ => 7} }) map { _.toStream.toList } getOrElse Nil assert_=== List(1, 7, 3, 4) unfold(3) { x => (x =/= 0) option (x, x - 1) }.toList assert_=== List(3, 2, 1) ``` </div> <div markdown="1" class="cheatsheet"> ### DList[A] ```scala DList.unfoldr(3, { (x: Int) => (x =/= 0) option (x, x - 1) }).toList assert_=== List(3, 2, 1) ``` </div> <div markdown="1" class="cheatsheet"> ### Lens[A, B] = LensT[Id, A, B] ```scala val t0 = Turtle(Point(0.0, 0.0), 0.0) val t1 = Turtle(Point(1.0, 0.0), 0.0) val turtlePosition = Lens.lensu[Turtle, Point] ( (a, value) => a.copy(position = value), _.position) val pointX = Lens.lensu[Point, Double] ( (a, value) => a.copy(x = value), _.x) val turtleX = turtlePosition >=> pointX turtleX.get(t0) assert_=== 0.0 turtleX.set(t0, 5.0) assert_=== Turtle(Point(5.0, 0.0), 0.0) turtleX.mod(_ + 1.0, t0) assert_=== t1 t0 |> (turtleX =>= {_ + 1.0}) assert_=== t1 (for { x <- turtleX %= {_ + 1.0} } yield x) exec t0 assert_=== t1 (for { x <- turtleX := 5.0 } yield x) exec t0 assert_=== Turtle(Point(5.0, 0.0), 0.0) (for { x <- turtleX += 1.0 } yield x) exec t0 assert_=== t1 ``` </div> <div markdown="1" class="cheatsheet"> ### Validation[+E, +A] ```scala (1.success[String] |@| "boom".failure[Int] |@| "boom".failure[Int]) {_ |+| _ |+| _} assert_=== "boomboom".failure[Int] (1.successNel[String] |@| "boom".failureNel[Int] |@| "boom".failureNel[Int]) {_ |+| _ |+| _} assert_=== NonEmptyList("boom", "boom").failure[Int] "1".parseInt.toOption assert_=== 1.some ``` </div> <div markdown="1" class="cheatsheet"> ### Writer[+W, +A] = WriterT[Id, W, A] ```scala (for { x <- 1.set("log1"); _ <- "log2".tell } yield (x)).run assert_=== ("log1log2", 1) import std.vector._ MonadWriter[Writer, Vector[String]].point(1).run assert_=== (Vector(), 1) ``` </div> <div markdown="1" class="cheatsheet"> ### \/[+A, +B] ```scala 1.right[String].isRight assert_=== true 1.right[String].isLeft assert_=== false 1.right[String] | 0 assert_=== 1 // getOrElse ("boom".left ||| 2.right) assert_=== 2.right // orElse ("boom".left[Int] >>= { x => (x + 1).right }) assert_=== "boom".left[Int] (for { e1 <- 1.right; e2 <- "boom".left[Int] } yield (e1 |+| e2)) assert_=== "boom".left[Int] ``` </div> <div markdown="1" class="cheatsheet"> ### Kleisli[M[+_], -A, +B] ```scala val k1 = Kleisli { (x: Int) => (x + 1).some } val k2 = Kleisli { (x: Int) => (x * 100).some } (4.some >>= k1 compose k2) assert_=== 401.some (4.some >>= k1 <=< k2) assert_=== 401.some (4.some >>= k1 andThen k2) assert_=== 500.some (4.some >>= k1 >=> k2) assert_=== 500.some ``` </div> <div markdown="1" class="cheatsheet"> ### Reader[E, A] = Kleisli[Id, E, A] ```scala Reader { (_: Int) + 1 } ``` </div> <div markdown="1" class="cheatsheet"> ### trait Memo[K, V] ```scala val memoizedFib: Int => Int = Memo.mutableHashMapMemo { case 0 => 0 case 1 => 1 case n => memoizedFib(n - 2) + memoizedFib(n - 1) } ``` </div> <div markdown="1" class="cheatsheet"> ### State[S, +A] = StateT[Id, S, A] ```scala State[List[Int], Int] { case x :: xs => (xs, x) }.run(1 :: Nil) assert_=== (Nil, 1) (for { xs <- get[List[Int]] _ <- put(xs.tail) } yield xs.head).run(1 :: Nil) assert_=== (Nil, 1) ``` </div> <div markdown="1" class="cheatsheet"> ### ST[S, A]/STRef[S, A]/STArray[S, A] ```scala import scalaz._, Scalaz._, effect._, ST._ type ForallST[A] = Forall[({type l[x] = ST[x, A]})#l] def e1[S]: ST[S, Int] = for { x <- newVar[S](0) _ <- x mod {_ + 1} r <- x.read } yield r runST(new ForallST[Int] { def apply[S] = e1[S] }) assert_=== 1 def e2[S]: ST[S, ImmutableArray[Boolean]] = for { arr <- newArr[S, Boolean](3, true) x <- arr.read(0) _ <- arr.write(0, !x) r <- arr.freeze } yield r runST(new ForallST[ImmutableArray[Boolean]] { def apply[S] = e2[S] })(0) assert_=== false ``` </div> <div markdown="1" class="cheatsheet"> ### IO[+A] ```scala import scalaz._, Scalaz._, effect._, IO._ val action1 = for { x <- readLn _ <- putStrLn("Hello, " + x + "!") } yield () action1.unsafePerformIO ``` </div> <div markdown="1" class="cheatsheet"> ### IterateeT[E, F[`_`], A]/EnumeratorT[O, I, F[`_`]] ```scala import scalaz._, Scalaz._, iteratee._, Iteratee._ (length[Int, Id] &= enumerate(Stream(1, 2, 3))).run assert_=== 3 (length[scalaz.effect.IoExceptionOr[Char], IO] &= enumReader[IO](new BufferedReader(new FileReader("./README.md")))).run.unsafePerformIO ``` </div> <div markdown="1" class="cheatsheet"> ### Free[S[+`_`], +A] ```scala import scalaz._, Scalaz._, Free._ type FreeMonoid[A] = Free[({type λ[+α] = (A,α)})#λ, Unit] def cons[A](a: A): FreeMonoid[A] = Suspend[({type λ[+α] = (A,α)})#λ, Unit]((a, Return[({type λ[+α] = (A,α)})#λ, Unit](()))) def toList[A](list: FreeMonoid[A]): List[A] = list.resume.fold( { case (x: A, xs: FreeMonoid[A]) => x :: toList(xs) }, { _ => Nil }) toList(cons(1) >>= {_ => cons(2)}) assert_=== List(1, 2) ``` </div> <div markdown="1" class="cheatsheet"> ### Trampoline[+A] = Free[Function0, A] ```scala import scalaz._, Scalaz._, Free._ def even[A](ns: List[A]): Trampoline[Boolean] = ns match { case Nil => return_(true) case x :: xs => suspend(odd(xs)) } def odd[A](ns: List[A]): Trampoline[Boolean] = ns match { case Nil => return_(false) case x :: xs => suspend(even(xs)) } even(0 |-> 3000).run assert_=== false ``` </div> <div markdown="1" class="cheatsheet"> ### Imports ```scala import scalaz._ // imports type names import scalaz.Id.Id // imports Id type alias import scalaz.std.option._ // imports instances, converters, and functions related to `Option` import scalaz.std.AllInstances._ // imports instances and converters related to standard types import scalaz.std.AllFunctions._ // imports functions related to standard types import scalaz.syntax.monad._ // injects operators to Monad import scalaz.syntax.all._ // injects operators to all typeclasses and Scalaz data types import scalaz.syntax.std.boolean._ // injects operators to Boolean import scalaz.syntax.std.all._ // injects operators to all standard types import scalaz._, Scalaz._ // all the above ``` </div> <div markdown="1" class="cheatsheet"> ### Note ```scala type Function1Int[A] = ({type l[x]=Function1[Int, x]})#l[A] type Function1Int[A] = Function1[Int, A] ``` </div> </td> </tr> </table> C# LINQ for Scala heads https://eed3si9n.com/csharp-linq-for-scala-heads/ Sun, 22 Jul 2012 00:00:00 +0000 https://eed3si9n.com/csharp-linq-for-scala-heads/ <p>This is a memo of C# Linq features for Scala programmers. Or vice versa.</p> <h2 id="type-inference">Type inference</h2> <p>C# has type inference. I try to use <code>var</code> when I can for local variables.</p> <csharp> var x = 1; </csharp> <p>Scala also has <code>var</code>, but the preferred way is to use immutable <code>val</code> if possible.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">val</span> x <span style="color:#66d9ef">=</span> <span style="color:#ae81ff">1</span> </span></span></code></pr IKEA DIY standing desk https://eed3si9n.com/ikea-diy-standing-desk/ Mon, 07 May 2012 00:00:00 +0000 https://eed3si9n.com/ikea-diy-standing-desk/ <img src="https://eed3si9n.com/images/standing-desk-400.jpg" height="225" width="300" /> sbt plugins roundup https://eed3si9n.com/sbt-plugins-roundup/ Wed, 11 Apr 2012 00:00:00 +0000 https://eed3si9n.com/sbt-plugins-roundup/ <p>Unlike XML-based build tools sbt&rsquo;s build definitions are written in Scala (for both .sbt and .scala). This means that once one gets over the hurdle of learning sbt&rsquo;s concepts and operators, it doesn&rsquo;t take much for build users to start writing sbt plugins.</p> <p>I&rsquo;ve ported a few from sbt 0.7 before, but I&rsquo;ve also been writing some original ones recently that I&rsquo;d like to share.</p> <h2 id="sbt-dirty-money">sbt-dirty-money</h2> <p><a href="https://github.com/sbt/sbt-dirty-money">sbt-dirty-money</a> is a plugin to clean Ivy cache somewhat selectively (anything that includes <code>organization</code> and <code>name</code> under <code>~/.ivy2/cache</code>). It was such a simplistic 25-line implementation, but <code>clean-cache</code> and <code>clean-local</code> tasks continue to be useful for me.</p> treehugger.scala pamflet https://eed3si9n.com/treehugger_pamflet/ Mon, 16 Jan 2012 00:00:00 +0000 https://eed3si9n.com/treehugger_pamflet/ <p>treehugger is a library to write Scala source code programmatically. It&rsquo;s also an implementation of Scala AST based on Reflection API, now available from github <a href="https://github.com/eed3si9n/treehugger">eed3si9n/treehugger</a>.</p> <p><strong>Edit:</strong> I&rsquo;ve expanded this into a complete guide using awesome <a href="https://github.com/n8han/pamflet">n8han/pamflet</a>.</p> <ul> <li><a href="http://eed3si9n.com/treehugger">See treehugger&rsquo;s pamflet</a></li> </ul> implicit parameter precedence again https://eed3si9n.com/implicit-parameter-precedence-again/ Sat, 07 Jan 2012 00:00:00 +0000 https://eed3si9n.com/implicit-parameter-precedence-again/ <p>Scala the language is one of the most elegant, expressive, consistent, and pragmatic languages. From pattern matching to the uniform access principle, it got so many things right. And Scala the ecosystem and Scala the community only makes it better.</p> <p>In Scala 2.9.1, locally declared implicits are preferred over imported ones. The problem is that the spec does not cover such behavior. My original hypothesis was that either I did not understand the spec correctly, or the spec was wrong. Based on the assumptions, I set out to explore <a href="http://eed3si9n.com/revisiting-implicits-without-import-tax">the implicits resolution precedence last week</a>. Like MythBusters say, the best kind of result is when you get something totally unexpected. It turns out that both of the hypotheses were wrong.</p> revisiting implicits without import tax https://eed3si9n.com/revisiting-implicits-without-import-tax/ Mon, 02 Jan 2012 00:00:00 +0000 https://eed3si9n.com/revisiting-implicits-without-import-tax/ <p><a href="http://nescala.org/">Northeast Scala Symposium 2012</a> is coming up in a few months, but I want to revisit a talk from this year&rsquo;s nescala to wrap up 2011. One after the other, nescala had amazingly high quality of talks. <a href="http://nescala.org/2011/">You can check them all out here</a>. With Daniel&rsquo;s Functional Data Structure and Jonas&rsquo;s Akka each having an hour-long key notes, the symposium left an impression on me that actors and FP are two major forces within Scala community. (Paul declaring that sending messages to actors is not referentially transparent was a hint too, I guess) There were also earlier signs of how the year turned out, like Mark&rsquo;s sbt 0.9 presentation and Nermin&rsquo;s Scala performance consideration. One talk that stood out in terms of immediate impact to change my code was Josh&rsquo;s talk: Implicits without the import tax: How to make clean APIs with implicits.</p> an unofficial guide to sbt 0.10 v2.0 https://eed3si9n.com/sbt-010-guide/ Sun, 25 Sep 2011 00:00:00 +0000 https://eed3si9n.com/sbt-010-guide/ <blockquote> <h2 id="version-20">version 2.0</h2> <p>When the original version was published on 06/19/2011, the motive for writing this guide was to aid the effort of moving people over to sbt 0.10 from 0.7, inspired by Mark&rsquo;s sbt 0.10 demos that I was able to see live (first at <a href="http://vimeo.com/20263617">northeast scala</a>, and second at <a href="http://days2011.scala-lang.org/node/138/285">scala days 2011</a>). At the time, the plugins were considered to be a major roadblock to the migration, since build users can&rsquo;t move to 0.10 without the plugins. So my strategy was to port the plugins myself if they weren&rsquo;t there, ask questions on the mailing list when I get stuck, and write up the results. I&rsquo;ve gotten many positive feedbacks, and it&rsquo;s helped people get on to 0.10. However, as it turns out, my understanding of sbt 0.10 wasn&rsquo;t always complete, and downright wrong and misleading at times. I take responsibility of my writing. Instead of leaving old contents in, I&rsquo;ve decided to push it into <a href="https://github.com/eed3si9n/eed3si9n.com/blob/master/original/sbt-010-guide.md">github</a>, make a new version and move on. The most up-to-date knowledge of writing plugins is compiled in <a href="https://github.com/harrah/xsbt/wiki/Plugins-Best-Practices">Plugins Best Practices</a> written mostly by <a href="https://github.com/bmc">Brian</a> and <a href="https://github.com/jsuereth">Josh</a>, and a tiny section by me.</p> testing sbt plugins https://eed3si9n.com/testing-sbt-plugins/ Sun, 18 Sep 2011 00:00:00 +0000 https://eed3si9n.com/testing-sbt-plugins/ <blockquote> <p><strong>NOTE:</strong> Official docs: <a href="http://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html">http://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html</a></p> </blockquote> <p>Let&rsquo;s talk about testing. Once you write a plugin, it turns into a long-term thing. To keep adding new features (or to keep fixing bugs), writing tests makes sense. But how does one go about testing a plugin to a build tool? We fly, of course.</p> <h2 id="scripted-test-framework">scripted test framework</h2> <p>sbt comes with <a href="http://code.google.com/p/simple-build-tool/wiki/ChangeDetectionAndTesting#Scripts">scripted test framework</a>, which let&rsquo;s you script a build scenario. It was written to test sbt itself on complex scenarios such as change detection and partial compilation:</p> sff4s: simple future facade for Scala https://eed3si9n.com/sff4s/ Mon, 29 Aug 2011 00:00:00 +0000 https://eed3si9n.com/sff4s/ <p>I wish there was a common super trait for various future implementations in the standard library, so I can express the concept without tying the code to a specific platform stack. I am not sure if there are others who feel the same, but I think it would be useful for library authors. That&rsquo;s my motivation of writing <a href="https://github.com/eed3si9n/sff4s">sff4s</a>.</p> <h2 id="what-is-future">what is future?</h2> <p>You&rsquo;ve probably come across the notion before but let&rsquo;s go over it quickly. A future value (also known as promise) represents an incomplete calculation.</p> beginning sbt 0.10 https://eed3si9n.com/beginning-sbt-010/ Mon, 18 Jul 2011 00:00:00 +0000 https://eed3si9n.com/beginning-sbt-010/ <p>On 7/13/2011 I hosted a ny-scala meetup on sbt 0.10 migration with doug tangren and rose toomey. Here is the slides.</p> <ul> <li><a href="http://sbt010.lessis.me/">beginning sbt 0.10 picture show</a></li> </ul> Vibrant Ink for IntelliJ IDEA https://eed3si9n.com/vibrant-ink-intellij-idea/ Fri, 20 May 2011 00:00:00 +0000 https://eed3si9n.com/vibrant-ink-intellij-idea/ <p><a href="https://github.com/eed3si9n/color-themes/tree/master/IntelliJ-IDEA/Vibrant-Ink">Vibrant Ink theme</a>.</p> <p><img alt="screenshot" src="https://github.com/eed3si9n/color-themes/raw/master/IntelliJ-IDEA/Vibrant-Ink/cropped.png"></p> Twilight for IntelliJ IDEA https://eed3si9n.com/twilight-intellij-idea/ Thu, 30 Dec 2010 00:00:00 +0000 https://eed3si9n.com/twilight-intellij-idea/ <p>I&rsquo;ve tried other IDEs for Scala, but always ended up going back to TextMate. As I am getting on the IntelliJ IDEA wagon, I&rsquo;ve made a <a href="https://github.com/eed3si9n/color-themes/tree/master/IntelliJ-IDEA/Twilight">Twilight theme</a> to make the ride smoother.</p> <p><img alt="screenshot" src="https://github.com/eed3si9n/color-themes/raw/master/IntelliJ-IDEA/Twilight/cropped.png"></p> typeclass-based XML data binding https://eed3si9n.com/typeclass-based-xml-data-binding/ Tue, 07 Dec 2010 00:00:00 +0000 https://eed3si9n.com/typeclass-based-xml-data-binding/ <p>Ultimately, the users of scalaxb are interested the real problems that the entity objects express, not how they persist into XML. That&rsquo;s why I knew I eventually had to vacate the singleton/companion object of the case class to implement the data binding. Until recently it has been generating the data binding implementation as follows:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-scala" data-lang="scala"><span style="display:flex;"><span><span style="color:#66d9ef">object</span> <span style="color:#a6e22e">Address</span> <span style="color:#66d9ef">extends</span> rt<span style="color:#f92672">.</span><span style="color:#a6e22e">ElemNameParser</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Address</span><span style="color:#f92672">]</span> <span style="color:#f92672">{</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">val</span> targetNamespace <span style="color:#66d9ef">=</span> <span style="color:#e6db74">&#34;http://www.example.com/IPO&#34;</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">def</span> parser<span style="color:#f92672">(</span>node<span style="color:#66d9ef">:</span> <span style="color:#66d9ef">scala.xml.Node</span><span style="color:#f92672">)</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Parser</span><span style="color:#f92672">[</span><span style="color:#66d9ef">Address</span><span style="color:#f92672">]</span> <span style="color:#66d9ef">=</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">def</span> toXML<span style="color:#f92672">(</span><span style="color:#a6e22e">__obj</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">Address</span><span style="color:#f92672">,</span> <span style="color:#a6e22e">__namespace</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">String</span><span style="color:#f92672">,</span> <span style="color:#a6e22e">__elementLabel</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">String</span><span style="color:#f92672">,</span> <span style="color:#a6e22e">__scope</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">scala.xml.NamespaceBinding</span><span style="color:#f92672">)</span><span style="color:#66d9ef">:</span> <span style="color:#66d9ef">scala.xml.NodeSeq</span> <span style="color:#f92672">=</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">...</span> </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span> </span></span></code></pr git memo https://eed3si9n.com/git/ Fri, 23 Apr 2010 00:00:00 +0000 https://eed3si9n.com/git/ <h2 id="global-gitignore">global gitignore</h2> <p>See <a href="https://help.github.com/articles/ignoring-files">Create a global .gitignore</a>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ git config --global core.excludesfile ~/.gitignore_global </span></span></code></pre></div><h2 id="checking-out-pull-requests-locally">checking out pull requests locally</h2> <p>See <a href="https://gist.github.com/piscisaureus/3342247">Checking out pull requests locally</a>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#f92672">[</span>remote <span style="color:#e6db74">&#34;origin&#34;</span><span style="color:#f92672">]</span> </span></span><span style="display:flex;"><span> url <span style="color:#f92672">=</span> [email protected]:sbt/sbt.git </span></span><span style="display:flex;"><span> fetch <span style="color:#f92672">=</span> +refs/heads/*:refs/remotes/origin/* </span></span><span style="display:flex;"><span> fetch <span style="color:#f92672">=</span> +refs/pull/*/head:refs/remotes/origin/pr/* </span></span></code></pre></div> Scala and OSGi using NetBeans https://eed3si9n.com/scala-osgi-using-netbeans/ Fri, 15 Jan 2010 00:00:00 +0000 https://eed3si9n.com/scala-osgi-using-netbeans/ <!--break--> <p>For some reason, I can&rsquo;t keep OSGi in my head. Everything I read about it slips away in a few weeks, and I have re-read the guides and tutorials.</p> <p>Here&rsquo;s a memo of setting up OSGi bundle written in Scala using NetBeans, following Neil Barlett&rsquo;s <a href="http://neilbartlett.name/blog/osgibook/">OSGi in Practice</a>, except the book uses Eclipse.</p> <h3 id="installing-scala-on-mac">Installing Scala on Mac</h3> <p>Skip this section if you use non-Mac. Install <a href="http://www.macports.org/">MacPorts</a>. Run the following from Terminal:</p> Layered Architecture https://eed3si9n.com/layered-architecture/ Mon, 07 Dec 2009 00:00:00 +0000 https://eed3si9n.com/layered-architecture/ <p>One of my favorites from msdn is <a href="http://msdn.microsoft.com/en-us/library/ee817664.aspx">Application Architecture for .NET: Designing Applications and Services</a> by <a href="http://edjez.instedd.org/">Eduardo Jezierski</a>. The version 2.0 is <a href="http://msdn.microsoft.com/en-us/library/dd673617.aspx">Microsoft Application Architecture Guide</a> by <a href="http://blogs.msdn.com/jmeier/">J.D. Meier</a> et al, but it&rsquo;s much more beefier than the original. Currently 1.0 is put under Retired node in msdn.</p> Scala and Evaluation Strategy https://eed3si9n.com/scala-and-evaluation-strategy/ Wed, 21 Oct 2009 00:00:00 +0000 https://eed3si9n.com/scala-and-evaluation-strategy/ <p>Once you use any technology to a significant extent, you understand its strength and shortcomings. I&rsquo;ve probably written tens of thousands of lines of code in Delphi or C++, Java and C# too to some extent. I&rsquo;ve depended on those languages, but gripe about them too. The new language obviously has the advantage of just being new. Since I haven&rsquo;t written anything significant in Scala besides Tetris, I haven&rsquo;t hit the shortcomings yet.</p> Where the Wild Things Are (2009) https://eed3si9n.com/where-the-wild-things-are/ Mon, 19 Oct 2009 00:00:00 +0000 https://eed3si9n.com/where-the-wild-things-are/ <!--break--> <img src="https://eed3si9n.com/images/16where_600.jpg" alt="" /> <p>I haven&rsquo;t read the original book, so this is purely based on the film work by <a href="http://en.wikipedia.org/wiki/Spike_Jonze">Spike Jonze</a>.</p>