This version of the site is now archived. See the next version at v5.chriskrycho.com.

Exploring 4 Languages: Project Setup

Getting Rust, Elm, F, and ReasonML installed; their editor plugins configured; and their project files ready.

January 01, 2018Filed under Tech#domain-driven design#elm#four-languages#fsharp#functional programming#reasonml#rustMarkdown source

In this post, I’m just going to briefly talk through the steps I needed to do to set up each of the languages and my editor setup for them. Gladly, it was pretty simple. At the end, I’ll offer a note on my thoughts on the setup processes. (Note that this isn’t “How to do this for anyone ever”—it’s “how I did it, with some notes where it might be relevant to you.”)

For context, I’m running macOS and using VS Code as my editor. Whenever I say “Install the VS Code extension,” you can do it either by opening the extension side panel and searching for <Extension Name>, or by typing ext install <extension label>—I’ll write it like <Extension Name>/<extension label>.

The source code as of what I’m describing in this post is at the project-setup tag in the repo.

Rust

  • Language installation: Install rustup: curl https://sh.rustup.rs -sSf | sh1.
  • Editor setup: Installed the VS Code extension: Rust (rls)/rust.
  • Project setup: In the root of my repo, I ran cargo new rust.

Elm

  • Language installation: There are installers, but I just did npm i -g elm.
  • Editor setup: Installed the VS Code Elm extension: Elm/elm.2
  • Project setup:
    • Install the create-elm-app tool: npm i -g create-elm-app
    • In the root of the project, I ran create-elm-app elm.

F

  • Language installation: Install mono: brew install mono (note installation instructions here).
  • Editor setup: Install the VS Code Ionide extension: Ionide-fsharp/ionide-fsharp. It’ll automatically install the associated Paket and FAKE extensions from the Ionide project as well, and those will install Paket and FAKE during installation.
  • Project setup:
    • In the root of the repo, I created the fsharp directory.
    • Then I opened a VS Code instance to to that directory, opened the command palette, and ran F#: New Project.
      • I chose console
      • I left the directory blank
      • I named the project dmmf (for Domain Modeling Made Functional).
      • Since F (like C) prefers PascalCase names, I renamed the generated module DMMF.

ReasonML

  • Language installation: Following the setup instructions here, I ran npm install -g bs-platform.
  • Editor setup: following the official instructions
    • I ran npm install -g https://github.com/reasonml/reason-cli/archive/3.0.4-bin-darwin.tar.gz to install the dependencies for the editor configuration.
    • I installed the VS Code extension: Reason/reasonml.
  • Project setup: In the root of the repo, I ran bsb -init reason -theme basic-reason.

Comments on the setup processes

Most of the languages have fairly straightforward processes to get up and running with a good-to-excellent tooling experience.

The best of them is Rust, which is extremely easy to get up and running with.3 Elm is roughly in the middle—it’s less straightforward than Rust in that create-elm-app is not an officially supported approach, unlike rustup and cargo, so you’re going to have a much less awesome experience if you don’t know about it.

Reason and F both have slightly larger negatives.

Reason requires you to npm install a large, gzipped file with multiple dependencies all bundled, instead of having a dedicated installer a la rustup. It also has the possibility for a not-so-great first-run experience in the editor, which I discovered all too quickly.

F essentially requires you to use an editor extension to get the language setup with Paket, which is a much better choice of package manager than the default .NET package manager NuGet. Command line tools exist and are improving rapidly, and you can get them working… but it’s harder than it needs to be. And that project setup wizard is fine, but it’s a lot noisier than just doing create-elm-app or especially cargo new.

In any case, though, I have them all up and running now! More soon!


  1. If you’re uncomfortable with running that script, there are other options as well.

  2. Note that the VS Code extension is not the best experience out there for Elm: the Atom extensions (language-elm and elmjutsu) are. I stuck with VS Code because it’s good enough and, more importantly, the Code extensions are arguably best in class for the other languages… and it’s what I use every day.

  3. I’m not just saying that because I’m a Rust fanboy, either! If Rust were hard to use, I’d be complaining louder because of my enthusiasm for the language.