News for hackers. Stuff that matters.
Re:Deploying a ReasonML React app with Docker by Kwastie on Tuesday February 06, 2018 @06:35AM (#16315600)
With pure Reason (No JS bindings) it should be possible to skip Node / Bucklescript on the server and compile straight to binary.

This should be possible with something like bsb-native (https://github.com/bsansouci/bsb-native)

I haven't tried this because I don't have a pure Reason project

Re:Deploying a ReasonML React app with Docker by cies on Tuesday February 06, 2018 @07:25AM (#16315805)
Anyone interested in this please look at:

https://github.com/inhabitedtype/httpaf

A webserver in native OCaml that's going to beat Node.js (it seems popular cohttp server in OCaml was not cutting it).

Re:Deploying a ReasonML React app with Docker by weberc2 on Tuesday February 06, 2018 @10:08AM (#16316650)
I would be really interested about why this is getting downvoted? This seems like a related project, and I was happy to learn about it.
Re:Deploying a ReasonML React app with Docker by cies on Tuesday February 06, 2018 @10:42AM (#16316925)
I'm back in the plus. Also cannot imagine someone down voting :-P
Re:Deploying a ReasonML React app with Docker by tessierashpool on Tuesday February 06, 2018 @11:16AM (#16317194)
not a downvoter, but probably the “going to beat Node” part. an assertion which cannot be proved or refuted, and which is vague but provocative.

edit: actually I became a downvoter just now.

Re:Deploying a ReasonML React app with Docker by cies on Tuesday February 06, 2018 @11:53AM (#16317495)
cohttp is not going to beat Node. Compiled code in a reasonably low level language should be able to beat (measures in all resources used, not just response times, but also mem/cpu consumption) an interpreted language for a simple task of responding to network requests. Well, that's at least what I believe, maybe I'm wrong.
Re:Deploying a ReasonML React app with Docker by tessierashpool on Tuesday February 06, 2018 @12:12PM (#16317640)
this is also a vague but provocative claim. beat Node at what? what's the criteria for success? popularity? performance? security? I don't have a downvote for you, but answering a vague but provocative claim with another vague but provocative claim is not really that helpful in my opinion.

"my language can beat up your language" is like "my dad can beat up your dad."

Re:Deploying a ReasonML React app with Docker by cwyers on Tuesday February 06, 2018 @12:32PM (#16317790)
ReasonML has two compilers -- a compiler that goes to JavaScript, and a compiler that goes to native code (the OCaml compiler, since Reason and OCaml share an AST/etc.) So if you want to use ReasonML with a web server, you have two options:

1) A native web server, or 2) NodeJS.

Because Reason can compile to JS, you can use with Node just like any other compiles-to-JS language. The claim here (which I have no opinion on either way) is that using a particular native OCaml web server with ReasonML is faster than compiling ReasonML to JS and using it with Node.

Re:Deploying a ReasonML React app with Docker by cies on Tuesday February 06, 2018 @02:43PM (#16318912)
> that using a particular native OCaml web server with ReasonML is faster than compiling ReasonML to JS and using it with Node.

Faster considering the resources used (mem/cpu). Yups. Exactly that was my claim. Cohttp cannot beat Node, while a natively compiled OCaml server should be able to beat node.

Re:Deploying a ReasonML React app with Docker by Drup on Tuesday February 06, 2018 @07:00AM (#16315693)
> This should be possible with something like bsb-native (https://github.com/bsansouci/bsb-native)

Why not just use the real OCaml/Reason compiler ... ?

Re:Deploying a ReasonML React app with Docker by thangngoc89 on Tuesday February 06, 2018 @07:30AM (#16315819)
bsb-native is not a compiler. It uses ocamlopt for compiling. Bsb-native is a build tool, think of it like make
Re:Deploying a ReasonML React app with Docker by jordwalke on Tuesday February 06, 2018 @07:04AM (#16315715)
Reason is supported on every major version of the native OCaml compiler (currently versions 4.02.3 up to 4.06).
Re:Deploying a ReasonML React app with Docker by Drup on Tuesday February 06, 2018 @10:05AM (#16316622)
I know, hence my question! Why go through bs (which is locked to an old version of OCaml) to distribute executables, when you can use the normal compiler and enjoy the latest improvements?
Re:Deploying a ReasonML React app with Docker by jordwalke on Tuesday February 06, 2018 @07:09PM (#16321202)
I don’t mean to ignore your observation - it is valid. Bsb is a build system that works with a specific form of packages. What you suggest could work too. The only (small?) challenge is that people have bsb JS projects, and they aren’t configured for jbuilder/Dune etc. Because of JavaScript’s immense popularity, the largest number of people will start with whatever build tools integrate well with the JavaScript ecosystem and work from there. This plays out quite predictably. Just as an example, the most important thing to web developers is that each Reason input file becomes a commonJS (or es6) module. That allows integrating your Reason React app with existing web apps easily. So since people start with whatever tools integrate well with the JS ecosystem, they then reach for the easiest tool available to adopt native compilation.
Re:Deploying a ReasonML React app with Docker by lilactown on Tuesday February 06, 2018 @11:39AM (#16317384)
I think that configuring jbuilder/etc. can be a point of friction for people coming from bucklescript, so bsb-native provides the same workflow for native compilation.
Re:Deploying a ReasonML React app with Docker by k__ on Tuesday February 06, 2018 @07:34AM (#16315838)
I once read about a project that was basically Node.js as Reason module. They used the OCaml std lib and wrapped it with a a very Node.js like interface, so you could write native stuff with your Node.js skills.
Re:Deploying a ReasonML React app with Docker by thangngoc89 on Tuesday February 06, 2018 @07:47AM (#16315899)
I think you’re talking about this https://kennetpostigo.github.io/lwt-node/
Re:Deploying a ReasonML React app with Docker by k__ on Tuesday February 06, 2018 @09:21AM (#16316333)
Yes, exactly :)