Tag: reason

Optional Attribute Access in Reason

November
13,
2018
·
graphql,
ocaml,
reason

One thing that you'll run into when interfacing with complex javascript objects in Reason, is that dealing with optional objects can be a huge pain. The most common place to run into this is when using the excellent graphql-ppx syntax plugin (often together with reason-apollo), because the result of a graphql query is a large complex javascript object, with many parts of it that are optional.

2 minute read

State of Reason Survey: Preliminary Results

November
10,
2018
·
ocaml,
reason

I'm planning to do some fancy social science analysis of the results, but first I'll just give you a dump of the summary data that came out of this.

First of all, there were 398 responses! Thanks to everyone who contributed :)

4 minute read

Deploying Native Reason/OCaml with Zeit's now.sh

September
7,
2018
·
server,
native,
ocaml,
reason

I'm working on a new ReasonReact project that will need a stateful server, and I thought it might be nice to write that in Reason too :) but what's the best way to deploy it? And by "best" I mean "easiest, with a free-to-try option". After looking around a little, I settled on Zeit's now.sh.

What did I end up with? A 10mb docker image with a server inside!

3 minute read

Reason mobile cross-compilation deep dive

January
23,
2018
·
android,
ios,
ocaml,
reason

I recently released a tool that will manage all of this stuff (see the accompanying blog post), but I figure it's good to document what I went through for future ocaml cross-compilation spelunkers.

7 minute read

Making a cross-platform mobile game in Reason/OCaml

January
13,
2018
·
android,
ios,
game,
reason

I launched the first cross-platform mobile native game written in Reason a few weeks ago 🎉, to the Android and iOS app stores, with a free web version and a macos desktop bundle (source code all on github).

Getting there required lots of fiddling with cross-compilers and build systems, and so I made a tool that will take away much of the pain involved, so you can get started immediately and get your game into the world. NB: This is still super experimental but I'm really excited about it and want to get y'all in on the fun.

4 minute read

Building async/await in Reason

December
30,
2017
·
await,
ocaml,
reason

Lots of people have come into the discord channel asking about how to elegantly deal with async things. We've got Promise.then_ and good old callbacks, but having a syntax like async/await can really make things nicer when you have a lot of async going on. So far in the web clients I've made, there hasn't been enough asynchrony to really feel that pain, but I thought it would be an interesting challenge to tackle anyway.

7 minute read

Advanced ReasonReact: Higher Order Components

November
12,
2017
·
react,
reason

After jumping into ReasonReact, I soon came to the question "How do I do higher-order components?" I had some duplicated logic in several components regarding data fetching, and I wanted to use this familiar React tool to refactor.

To illustrate, we'll be making a "fetches something from the network" wrapper component. We'll start with a "mixed component" that we'll then try to refactor.

5 minute read

A ReasonReact Tutorial

July
5,
2017
·
react,
tutorial,
ocaml,
reason

Are you a big fan of React, and want to know more about Reason/OCaml? I made this for you!

This tutorial was updated on Nov 8, 2017 for the new "v3" syntax of Reason.

Reason is a project that adds a JavaScript-style syntax and a bunch of conventions and tooling to OCaml. The goal is to make this awesome language, with its powerful type system and robust multi-platform compiler, accessible to a broader audience. It's backed by the good folks at Facebook who invented and built React, and so naturally having best-in-class React interop has been a high priority.

This tutorial aims to give you a nice introduction to the syntax and type system of Reason, through the ReasonReact library. We'll be building a simple Todo list application.

Read more

When will ReasonML be ready?

June
23,
2017
·
ocaml,
reason

Someone came into our discord channel a few days ago asking "Is Reason suitable for migrating a large production JavaScript codebase incrementally?" I answered "Yes, but wait 6 months."

What's the current status? At the moment, we're mostly in the realm of "enthusiasts who are OK with being on the bleeding edge, and want to help build out the foundation in their spare time."

4 minute read

Template-based macros in Reason/OCaml

June
20,
2017
·
macros,
ocaml,
reason

A couple of people have shown up in the discord channel asking whether Reason has macros, and the answer is "sort of." I think we can do better.

6 minute read

Your first native Reason/OCaml project

June
17,
2017
·
tutorial,
ocaml,
reason

I just wrote my first Reason project that compiled to native, and you can too! Luckily for you, my first native project was a cli tool to help people get started with native Reason development 🙌.

5 minute read

JavaScript Interop with Reason and BuckleScript

June
3,
2017
·
tutorial,
ocaml,
reason,
javascript

So you're all ready to write some Reason but you need to call a JavaScript function? Or maybe you can't figure out how to write something in OCaml-land and wish you could just bail for a minute & write it in JavaScript? Fortunately, both of those are fairly easy to pull off.

8 minute read

Getting Started with Reason and BuckleScript

June
3,
2017
·
ocaml,
reason,
javascript

A couple of people have asked me how to get up and running recently, so I thought I'd put something together. If you're looking for a "just clone this repo & go", here's a very simple boilerplate I put together for this post, or you can check out the reason-react-example repository.

3 minute read