Skip to content

Instantly share code, notes, and snippets.

@aleksandersumowski
Created May 22, 2017 16:18
Show Gist options
  • Save aleksandersumowski/fe413c701862025bfdffdfa9447bd1fa to your computer and use it in GitHub Desktop.
Save aleksandersumowski/fe413c701862025bfdffdfa9447bd1fa to your computer and use it in GitHub Desktop.

ReasonML first impressions

Objective: Get a fast development feedback cycle from reasonML to Javascript.

Tools:

  • npm
  • bsb: BuckleScript build system de
  • docker

Nowadays, getting a simple hello world to run might be a daunting task: es6 to es5 transpilation, bundling and getting the files in the browser, the dotfiles, etc.

If you add compiling some native extensions on top of that, and try to get it running on different OSs, you’re going to have a bad time.

At uSwitch, when we tried to do an small workshop to hack with reasonML we found we spent 80% of the time setting the platform, and 20% coding.

So we created a container to encapsulate the compiling process, you just mount a volume in your local reason files and it will spit the bundle for you. Getting it running for a simple example was easy enough just follow the steps from the section Project “Project Setup” from reasonML docs. I only got it running fixing the bs-platform dependency to 1.7.3, later versions will give a configuration error and stop working. You’ll end up having a tree like this:

.
├── bsconfig.json
├── package.json
└── src
    └── test.re

bsconfig.json is going to be the file to define our BuckleScript dependencies, for now we won’t be using any.

Package.json scripts

"scripts": {
  "build": "webpack -w",
  "bsb": "./node_modules/.bin/bsb -w"
},

TODO

  • Concurrently watch & build or use Bucklescript webpack loader
  • Finish proper docker image
  • Listening to events, talk about externals
  • Creating an small redux clone, hacker news reader application (?)
  • Type the DOM? I don’t think so.

Feedback doesn’t work on nixOs ocaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment