<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alain</title>
    <description>The latest articles on DEV Community by Alain (@idkjs).</description>
    <link>https://dev.to/idkjs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F13485%2F2efc9a75-3320-47d6-8ada-5c2fb72a4d99.jpeg</url>
      <title>DEV Community: Alain</title>
      <link>https://dev.to/idkjs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/idkjs"/>
    <language>en</language>
    <item>
      <title>Editor Support for ReasonML in VSCode with Melange</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Tue, 31 May 2022 12:22:54 +0000</pubDate>
      <link>https://dev.to/idkjs/editor-support-for-reasonml-in-vscode-with-melange-1i5l</link>
      <guid>https://dev.to/idkjs/editor-support-for-reasonml-in-vscode-with-melange-1i5l</guid>
      <description>&lt;p&gt;I have been trying for a long while now to work with ReasonML files in VSCode and get some syntax highlighting. This has been a problem since &lt;a href="https://reasonml.github.io/"&gt;ReasonML&lt;/a&gt; on the frontend has moved on to &lt;a href="https://rescript-lang.org/"&gt;Rescript&lt;/a&gt;. The solution would be using &lt;a href="https://dev.tourl"&gt;Melange&lt;/a&gt; but I could not get the editor highlighting to work. I have a bunch of old ReasonML projects that I still refer to so losing the editor support has been less than ideal. The code still works but you are stuck relying on the terminal output for errors. &lt;/p&gt;

&lt;p&gt;I finally got it to work with the help of &lt;a href="https://discord.com/channels/235176658175262720/825155604641218580/981161512905371688"&gt;@zecklar&lt;/a&gt; on the ReasonML Discord forum.&lt;/p&gt;

&lt;p&gt;Here is the solution that works.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install OCaml plugin &lt;a href="https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform"&gt;https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Build your project esy build&lt;/li&gt;
&lt;li&gt;Launch VSCode in your esy dev environment &lt;code&gt;esy code .&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;On the lefthand side, click OCaml extension icon&lt;/li&gt;
&lt;li&gt;Click "Select sandbox"&lt;/li&gt;
&lt;li&gt;Select "Custom" from the dropdown&lt;/li&gt;
&lt;li&gt;Pass the flag, the input box should contain $prog $args --fallback-read-dot-merlin&lt;/li&gt;
&lt;li&gt;Voila, at least typehints/navigation etc seem to work&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can try it with this &lt;a href="https://github.com/idkjs/melange-editor-support"&gt;repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This isnt working for rescript yet but I will update you if I figure it out.&lt;/p&gt;

&lt;p&gt;Many thank, @zecklar.&lt;/p&gt;

</description>
      <category>reason</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Using `let.opt` in Rescript with latest Reason/OCaml</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Sun, 11 Jul 2021 10:09:10 +0000</pubDate>
      <link>https://dev.to/idkjs/using-let-opt-in-rescript-with-latest-reason-ocaml-531n</link>
      <guid>https://dev.to/idkjs/using-let-opt-in-rescript-with-latest-reason-ocaml-531n</guid>
      <description>&lt;p&gt;This is your Reason &lt;code&gt;(let.opt&lt;/code&gt;) definition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let (let.opt) = (x, f) =&amp;gt;
  switch (x) {
  | None =&amp;gt; None
  | Some(x) =&amp;gt; f(x)
  };
let (and.opt) = (a, b) =&amp;gt;
  switch (a, b) {
  | (Some(a), Some(b)) =&amp;gt; Some((a, b))
  | _ =&amp;gt; None
  };
let z = (a,b)=&amp;gt; {
  let.opt a = a
  and.opt b = b;
  Some(a + b);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is your Rescript file on &lt;code&gt;ocaml@4.12.0&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Demo.res&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nn"&gt;Js&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"using ocaml 4.12 compiled reasonml let.opt in Rescript"&lt;/span&gt;, &lt;span class="nn"&gt;Opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;,&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here is a gist.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Here is a project you can run:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/idkjs" rel="noopener noreferrer"&gt;
        idkjs
      &lt;/a&gt; / &lt;a href="https://github.com/idkjs/letop-rescript" rel="noopener noreferrer"&gt;
        letop-rescript
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      using (let.opt) style in rescript
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Resources: &lt;a href="https://github.com/ocaml/ocaml/pull/1947" rel="noopener noreferrer"&gt;https://github.com/ocaml/ocaml/pull/1947&lt;/a&gt;&lt;br&gt;
Melange:&lt;a href="https://github.com/melange-re/melange" rel="noopener noreferrer"&gt;https://github.com/melange-re/melange&lt;/a&gt;&lt;br&gt;
Rescript:&lt;a href="https://rescript-lang.org/" rel="noopener noreferrer"&gt;https://rescript-lang.org/&lt;/a&gt;&lt;br&gt;
Discord:&lt;a href="https://discord.gg/KAJBzYaf" rel="noopener noreferrer"&gt;https://discord.gg/KAJBzYaf&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rescript</category>
      <category>reason</category>
      <category>melange</category>
      <category>ocaml</category>
    </item>
    <item>
      <title>From Reason/React to Rescript/React, Guaranteed Uncurrying </title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Mon, 05 Jul 2021 19:54:18 +0000</pubDate>
      <link>https://dev.to/idkjs/from-reason-react-to-rescript-react-guaranteed-uncurrying-2n91</link>
      <guid>https://dev.to/idkjs/from-reason-react-to-rescript-react-guaranteed-uncurrying-2n91</guid>
      <description>&lt;p&gt;&lt;a href="https://www.thingsguyana.com/author/nadira/"&gt;image credit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we get started, please do ping me if you need a ReasonML/Rescript dev on your team. &lt;/p&gt;

&lt;p&gt;I love reading old ReasonML code. The devs who took the time write ReasonML projects in the early days really had to know what they were doing and it shows. Its an excellent resource for learning both ReasonML and OCaml. For me, the older the code, the better. When I came across this &lt;a href="https://github.com/scottcheng/si-reason"&gt;repo&lt;/a&gt; and saw it was four years old, I could not resist. On top of that, its a wonderful little piece of code. &lt;/p&gt;

&lt;p&gt;Today's old repo is &lt;a href="https://github.com/scottcheng/si-reason"&gt;si-reason&lt;/a&gt; by &lt;a href="https://twitter.com/scottcheng"&gt;@scottcheng&lt;/a&gt; who was dabbling in ReasonML 4 years ago when the compiler was on &lt;code&gt;bs-platform@2.0.0&lt;/code&gt;. Except for his React version, his code ran today on Rescript and ReasonML latest. You can see what he built at &lt;a href="https://scottcheng.github.io/si-reason/"&gt;https://scottcheng.github.io/si-reason/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As I'm studying this old reason code, I do some clean up, update to latest ReasonML and get it working. Then I decide to switch the syntax to Rescript since that is the new thing and I come across this one line that doesn't work after converting it from ReasonML to Rescript. &lt;/p&gt;

&lt;h2&gt;
  
  
  Generated Rescript Version
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rescript"&gt;&lt;code&gt;  &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;, &lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;, &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;UpdateColumnPositions&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;columnPositions&lt;/span&gt;: &lt;span class="n"&gt;emptyColumnPositions&lt;/span&gt; 
        &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;, &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
          &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;, &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domElementToObj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="n"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;BoardBase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markerId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;, &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;,
            &lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="s2"&gt;"getBoundingClientRect"&lt;/span&gt;&lt;span class="p"&gt;]()&lt;/span&gt;
            &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"left"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;, &lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"top"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
          &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;,
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  , &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;columnPositions&lt;/span&gt;: &lt;span class="n"&gt;emptyColumnPositions&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;converts to&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;param&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;columnPositions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$$Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$$Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                                        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BoardBase$SiReason&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;markerId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                                        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                                                &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                                &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;top&lt;/span&gt;
                                              &lt;span class="p"&gt;];&lt;/span&gt;
                                      &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                        &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="nx"&gt;emptyColumnPositions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;columnPositions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;emptyColumnPositions&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Original ReasonML Version
&lt;/h2&gt;

&lt;p&gt;The same code in ReasonML:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ocaml"&gt;&lt;code&gt;    &lt;span class="nn"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;UpdateColumnPositions&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;columnPositions&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
              &lt;span class="n"&gt;emptyColumnPositions&lt;/span&gt;
              &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
                   &lt;span class="n"&gt;row&lt;/span&gt;
                   &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
                          &lt;span class="nn"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domElementToObj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                            &lt;span class="n"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;BoardBase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markerId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                          &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;##&lt;/span&gt;&lt;span class="n"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="bp"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;##&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;##&lt;/span&gt;&lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                      &lt;span class="p"&gt;})&lt;/span&gt;
                 &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;columnPositions&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;emptyColumnPositions&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;converts to:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;param&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;columnPositions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$$Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$$Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mapi&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                                        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BoardBase$SiReason&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;markerId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                                        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                                                &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                                &lt;span class="nx"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;top&lt;/span&gt;
                                              &lt;span class="p"&gt;];&lt;/span&gt;
                                      &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                        &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="nx"&gt;emptyColumnPositions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;columnPositions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;emptyColumnPositions&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is the code produced by the Rescript compiler. One works, one does not. &lt;/p&gt;

&lt;p&gt;If you can't see the difference, let me help you out. Here is a screenshot of the diff.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xoSgouLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9ghse8bbn5gikayeoik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xoSgouLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9ghse8bbn5gikayeoik.png" alt="image of git diff showing the files are the same"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The files are exactly the same.&lt;/p&gt;

&lt;p&gt;I produced this code by runnning &lt;code&gt;npx rescript convert -all&lt;/code&gt; which is documented here:&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;$ npx rescript convert -all 🔥&lt;/p&gt;— ReScript (@rescriptlang) &lt;a href="https://twitter.com/rescriptlang/status/1410150486515359747?ref_src=twsrc%5Etfw"&gt;June 30, 2021&lt;/a&gt;
&lt;/blockquote&gt;  

&lt;p&gt;This is an excellent script which up until this example, always worked when converting from Reason to Rescript. The conversion is one way though so if you like your Reason code, like I do, be aware of that.&lt;/p&gt;

&lt;p&gt;Back to the point. The code that fails was the Rescript code. If you look at the two versions of Javascript, you will notice that they are exactly the same. What happened? &lt;/p&gt;

&lt;p&gt;Per the Rescript docs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a dynamic language such as JS, currying would be dangerous, since accidentally forgetting to pass an argument doesn't error at compile time&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://rescript-lang.org/docs/manual/latest/bind-to-js-function#curry--uncurry"&gt;source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the Rescript docs are telling us that we might expect that using Rescript, your code might compile but then throw an error when its run.&lt;/p&gt;

&lt;p&gt;So is the ReasonML code safer in that regard? I image that the above statement can be made about ReasonML as well but that for some reason, the ReasonML code happens to produce &lt;code&gt;correct&lt;/code&gt; Javascript while the Rescript compiler does not. Anyone with an idea on why this is happening, please do share. I would love some feedback on it.&lt;/p&gt;

&lt;p&gt;In ReasonML, all functions are curried by default. I could tell you about it but &lt;a href="https://twitter.com/glennsl"&gt;@glennsl&lt;/a&gt; knows something about OCaml and ReasonML and explains it well here:&lt;/p&gt;


&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Gn-iPj_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/53618564/understanding-js-promise-resolve-dot-syntax-in-reasonml/53644093#53644093" rel="noopener noreferrer"&gt;
              &lt;span class="title-flare"&gt;answer&lt;/span&gt; re:  Understanding Js.Promise.resolve(. ) dot syntax in ReasonML
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Dec  6 '18&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/53618564/understanding-js-promise-resolve-dot-syntax-in-reasonml/53644093#53644093" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9mJpuJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          6
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wif5Zq3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;&lt;code&gt;(. )&lt;/code&gt; as used here, in function application, means the function should be called with an uncurried calling convention.&lt;/p&gt;
&lt;p&gt;When used in a function type, like the type of &lt;code&gt;resolve&lt;/code&gt; here, &lt;code&gt;(. 'a) =&amp;gt; unit&lt;/code&gt;, it means the function is uncurried.&lt;/p&gt;

&lt;p&gt;Ok, so what the hell does that mean…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/53618564/understanding-js-promise-resolve-dot-syntax-in-reasonml/53644093#53644093" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Or let Axel Rauschmayer, &lt;a href="https://twitter.com/rauschma"&gt;@rauschma&lt;/a&gt; tell you about on the seminal &lt;a href="https://2ality.com/2017/12/functions-reasonml.html#currying-(advanced)"&gt;2ality&lt;/a&gt; blog and twitter feed &lt;a href="https://twitter.com/2ality"&gt;@2ality&lt;/a&gt;;&lt;/p&gt;

&lt;p&gt;The fix for the Rescript code is easy is enough. Once you realize that the code might need to be curried by reading this post or through years of experience, well then you can curry the Rescript version and see what happens. You do that as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rescript"&gt;&lt;code&gt;      &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domElementToObj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="n"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;BoardBase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markerId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;, &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;,
            &lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="s2"&gt;"getBoundingClientRect"&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;.&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"left"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;, &lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"top"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Note the &lt;code&gt;(.)&lt;/code&gt; after &lt;code&gt;getBoundingClientRect&lt;/code&gt;. That is how you uncurry a function in both ReasonML and Rescript though the ReasonML version does not require it. It happens automatically. I guess this means that Rescript is &lt;code&gt;mostly&lt;/code&gt; curried by default. Again, if you need to &lt;code&gt;uncurry&lt;/code&gt; a function you need to add the dot as shown. &lt;/p&gt;

&lt;p&gt;This kind of silent break down is exactly the reason why I took up ReasonML. I could not take chasing down another silent error in Javascript code.&lt;/p&gt;

&lt;p&gt;The Rescript team is aware of this and have a section in the documentation addressing it. See &lt;a href="https://rescript-lang.org/docs/manual/latest/bind-to-js-function#solution-use-guaranteed-uncurrying"&gt;Use Guaranteed Uncurrying&lt;/a&gt; in the docs.&lt;/p&gt;

&lt;p&gt;Thanks for teaching &lt;a href="https://twitter.com/scottcheng"&gt;@scottcheng&lt;/a&gt;, &lt;a href="https://twitter.com/rauschma"&gt;@rauschma&lt;/a&gt; and &lt;a href="https://twitter.com/glennsl"&gt;@glennsl&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Having just converted and updated the existing repo, I'm thinking that maybe we can avoid this altogether by structuring the function differently. I'll try to do that and update this post.&lt;/p&gt;
&lt;h2&gt;
  
  
  Show me the code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/idkjs/si-reason"&gt;working reason code&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/idkjs/si-reason/tree/rescript-good"&gt;good rescript code&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/idkjs/si-reason/tree/rescript-repro"&gt;bug reproduction&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are into this sort of thing, here is a script I use to do a lot of the clean up.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



</description>
      <category>reason</category>
      <category>rescript</category>
      <category>curried</category>
      <category>functions</category>
    </item>
    <item>
      <title>Answer: How to make an tail recursive function and test it in ReasonML?</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Sun, 04 Jul 2021 14:16:31 +0000</pubDate>
      <link>https://dev.to/idkjs/answer-how-to-make-an-tail-recursive-function-and-test-it-in-reasonml-5fc1</link>
      <guid>https://dev.to/idkjs/answer-how-to-make-an-tail-recursive-function-and-test-it-in-reasonml-5fc1</guid>
      <description>&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;How do you test if this reasonml function is tail recursive. The simple version show you the unannottated function and &lt;code&gt;usingTailCall.re&lt;/code&gt; show its annotated in reasonml.&lt;/p&gt;

&lt;p&gt;Call in terminal with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ocamlc &lt;span class="nt"&gt;-annot&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; tailCall &lt;span class="nt"&gt;-pp&lt;/span&gt; &lt;span class="s2"&gt;"refmt -p ml"&lt;/span&gt; &lt;span class="nt"&gt;-impl&lt;/span&gt; tailCall.re
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check where the tail calls are with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep &lt;/span&gt;call &lt;span class="nt"&gt;-A1&lt;/span&gt; tailCall.annot 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Source: &lt;a href="https://stackoverflow.com/a/40401233/2336356"&gt;https://stackoverflow.com/a/40401233/2336356&lt;/a&gt;&lt;br&gt;
Sketch: &lt;a href="https://sketch.sh/s/eBl2Z0Wvd21azKu6SFzb9j/"&gt;https://sketch.sh/s/eBl2Z0Wvd21azKu6SFzb9j/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript file watching with Reason &amp; Rescript in Dune</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Wed, 12 May 2021 12:44:40 +0000</pubDate>
      <link>https://dev.to/idkjs/javascript-file-watching-with-reason-rescript-in-dune-4fk2</link>
      <guid>https://dev.to/idkjs/javascript-file-watching-with-reason-rescript-in-dune-4fk2</guid>
      <description>&lt;p&gt;While banging my head against the wall trying to understand the &lt;a href="https://dune.build"&gt;Dune&lt;/a&gt; build system used with OCaml and the &lt;a href="https://github.com/melange-re/melange"&gt;Melange&lt;/a&gt; project to compile &lt;a href="https://reasonml.github.io/"&gt;ReasonML&lt;/a&gt; and &lt;a href="https://rescript-lang.org/"&gt;Rescript&lt;/a&gt; to &lt;code&gt;js&lt;/code&gt;, I came across these great simple videos by &lt;a href="https://twitter.com/TheEduardoRFS"&gt;@TheEduardoRFS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most of below is from his &lt;a href="https://github.com/EduardoRFS/youtube-channel/blob/master/03-coding-ocaml-on-vscode/SCREENPLAY.md"&gt;hello intro&lt;/a&gt;. Thanks, Eduardo! Checkout his great videos at &lt;a href="https://www.youtube.com/c/EduardoRFS"&gt;https://www.youtube.com/c/EduardoRFS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You don't actually need this for &lt;code&gt;Rescript&lt;/code&gt; but this gets you all the extra latest &lt;code&gt;OCaml&lt;/code&gt; juice in the editor plus a whole lot more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Brief
&lt;/h2&gt;

&lt;p&gt;The following is a brief introduction on how to start coding in the mess that is the OCaml ecosystem.&lt;/p&gt;

&lt;p&gt;You can call me Eduardo and I will be helping you to setup an OCaml environment ... TODO: joke with trying&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction??
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What will you need?
&lt;/h3&gt;

&lt;p&gt;To do that, you will need a couple of tools, they're. The OCaml compiler. A build system. And a language server for VSCode, because no one deserves to code without autocomplete. Everything can be installed through a package manager, so you just get the package manager and that should be it.&lt;/p&gt;

&lt;p&gt;For this video we will be using &lt;code&gt;esy&lt;/code&gt;, an "easy" package manager for OCaml, mostly because it simplifies the life of Windows users a lot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows Warning
&lt;/h3&gt;

&lt;p&gt;Warning, if you're using windows, I'm sorry for you. Ok, seriously, if you're using windows everything here must be executed as admin, because "windows bad", to run VSCode as admin you need to close all VSCode windows and execute it as admin.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing esy
&lt;/h3&gt;

&lt;p&gt;To install esy, you're going to need the node package manager and git installed. If you have both, you can just put&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--global&lt;/span&gt; esy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;on your terminal.t should take a couple of seconds. But that's it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install project
&lt;/h2&gt;

&lt;p&gt;After that you can just clone my example project on github,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/idkjs/coding-ocaml-js-node.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter the folder &lt;code&gt;/hello&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And call &lt;code&gt;esy&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;esy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first time running &lt;code&gt;esy&lt;/code&gt; it will install everything that we need, so it will take a couple of minutes, but on subsequent executions everything is cached, so it should be quite fast. On windows it may take a long time and you need to run your VSCode and terminal as an admin.&lt;/p&gt;

&lt;p&gt;Add a rule with an alias to the &lt;code&gt;dune&lt;/code&gt; file to watch the JavaScript output, note the call to &lt;code&gt;node&lt;/code&gt;. I just took a shot in the dark and it worked. I don't know if there are docs on this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;rule
 &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;run_hello_js&lt;span class="o"&gt;)&lt;/span&gt;
 &lt;span class="o"&gt;(&lt;/span&gt;deps Hello.bs.js&lt;span class="o"&gt;)&lt;/span&gt;
 &lt;span class="o"&gt;(&lt;/span&gt;action
  &lt;span class="o"&gt;(&lt;/span&gt;run node ./Hello.bs.js&lt;span class="o"&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a script to &lt;code&gt;esy&lt;/code&gt; to watch the &lt;code&gt;js&lt;/code&gt; output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;"watch-js"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"esy b dune build @run_hello_js -w"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check if everything is working, you can call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;esy watch-js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see &lt;code&gt;Tu tu ru~ Mayushii desu!&lt;/code&gt;, that means everything is working and we can now setup VSCode.&lt;/p&gt;

&lt;p&gt;Works for &lt;code&gt;ReasonML&lt;/code&gt;, &lt;code&gt;Rescript&lt;/code&gt; and &lt;code&gt;OCaml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;esy hello-reason&lt;/code&gt; and &lt;code&gt;esy hello-rescript&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; esy hello-reason

Hello, Reason!

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; esy hello-rescript

Hello, Rescript!

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  VSCode
&lt;/h2&gt;

&lt;p&gt;You should go to your VSCode and install the extension "OCaml Platform". That's it, now you can open the example project on VSCode, open the file &lt;code&gt;Hello.ml&lt;/code&gt; and you should have everything working, autocomplete, types when you hover some identifier and in-editor typechecking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ending
&lt;/h2&gt;

&lt;p&gt;Yeah, now you can play with OCaml, like a prefessional. If you have any question send a comment below, something something like and subscribe.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://github.com/ulrikstrid/redemon"&gt;Redemon File Watcher&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This example use the &lt;a href="https://github.com/ulrikstrid/redemon"&gt;redemon&lt;/a&gt; file watcher.&lt;/p&gt;

&lt;p&gt;Add &lt;code&gt;redemon&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;opam pin add redemon https://github.com/ulrikstrid/redemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try the example from the docs.&lt;br&gt;
Run the following them change &lt;code&gt;index.js&lt;/code&gt; or create a file and you should see &lt;code&gt;Hello World!&lt;/code&gt; in the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redemon &lt;span class="nt"&gt;--path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./foo &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello World!"&lt;/span&gt;
Hello World!
&lt;span class="c"&gt;# after a change&lt;/span&gt;
Hello World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or pass &lt;code&gt;node index.js&lt;/code&gt; as a command and see the output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redemon &lt;span class="nt"&gt;--path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./foo node foo/index.js
hello
&lt;span class="c"&gt;# after editing text&lt;/span&gt;
hello again
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this helps!&lt;/p&gt;

</description>
      <category>rescript</category>
      <category>reason</category>
      <category>dune</category>
      <category>node</category>
    </item>
    <item>
      <title>Finite State Machines in ReScript</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Mon, 12 Apr 2021 12:09:38 +0000</pubDate>
      <link>https://dev.to/idkjs/finite-state-machines-in-rescript-1mok</link>
      <guid>https://dev.to/idkjs/finite-state-machines-in-rescript-1mok</guid>
      <description>&lt;h1&gt;
  
  
  Finite State Machines in ReScript
&lt;/h1&gt;

&lt;p&gt;I saw this excellent blog post by &lt;a href="https://twitter.com/erikras"&gt;@erikras&lt;/a&gt;, &lt;a href="https://erikras.com/blog/finite-state-machines-in-rescript"&gt;Finite State Machines in ReScript&lt;/a&gt;, but he didn't show the code implementing though he provides a demo on the blog post.&lt;/p&gt;

&lt;p&gt;I needed to know how to implement it so I when ahead and did it. Here it is: &lt;a href="https://github.com/idkjs/rescript-state-machine-twitter"&gt;rescript-state-machine-twitter&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Running
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git clone https://github.com/idkjs/rescript-state-machine-twitter
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;rescript-state-machine-twitter
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; yarn &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; yarn dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rescript</category>
      <category>statemachine</category>
    </item>
    <item>
      <title>npx resyntax</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Tue, 16 Mar 2021 13:01:11 +0000</pubDate>
      <link>https://dev.to/idkjs/npx-resyntax-2574</link>
      <guid>https://dev.to/idkjs/npx-resyntax-2574</guid>
      <description>&lt;h1&gt;
  
  
  npx resyntax
&lt;/h1&gt;

&lt;p&gt;I mess around with files in many syntaxes. &lt;code&gt;.re&lt;/code&gt; files get you better syntax highlighting in vscode so often I program in &lt;code&gt;.re&lt;/code&gt; or &lt;code&gt;.ml&lt;/code&gt; before converting to Rescript. Sharing in case it helps anyone else. It could be cleaner but it works mostly.&lt;/p&gt;

&lt;p&gt;Migrate files between &lt;code&gt;.re&lt;/code&gt; &lt;code&gt;.rei&lt;/code&gt; &lt;code&gt;.res&lt;/code&gt; &lt;code&gt;.resi&lt;/code&gt; &lt;code&gt;.ml&lt;/code&gt; &lt;code&gt;.mli&lt;/code&gt; syntaxes for &lt;a href="https://ocaml.org/"&gt;Ocaml&lt;/a&gt;,&lt;br&gt;
 &lt;a href="https://git.io/reasonml"&gt;ReasonML&lt;/a&gt; and &lt;a href="https://rescript-lang.org/"&gt;Rescript&lt;/a&gt; syntaxes.&lt;/p&gt;

&lt;p&gt;Doesn't always work so check your output. Especially for conversions from &lt;code&gt;.res&lt;/code&gt; to &lt;code&gt;.re&lt;/code&gt; or when convertion functors. See &lt;a href="https://github.com/rescript-lang/syntax/issues/264"&gt;https://github.com/rescript-lang/syntax/issues/264&lt;/a&gt;;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx resyntax
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gets you:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yb6xFYZE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oone0s2na8f6x8ub1a36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yb6xFYZE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oone0s2na8f6x8ub1a36.png" alt="run npx syntax in your terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Other Tools
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://git.io/bsconfig.json"&gt;npx bsconfig.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/idkjs/resgitignore"&gt;npx resgitignore&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/idkjs/resattributes"&gt;npx resattributes&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://twitter.com/share?text=Quickly+switch+between+ReasonML,+OCaml,+Rescript+syntaxes+in+your+project+https://github.com/idkjs/resyntax"&gt;Share on Twitter...&lt;/a&gt;
&lt;/h3&gt;

</description>
      <category>ocaml</category>
      <category>reason</category>
      <category>bucklescript</category>
      <category>rescript</category>
    </item>
    <item>
      <title>XCode, Opam, PNPM, Node, Esy, Docker, ReactNative on 128GB Mac</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Sat, 23 Jan 2021 15:52:05 +0000</pubDate>
      <link>https://dev.to/idkjs/opam-pnpm-node-esy-docker-reactnative-on-128gb-mac-o5h</link>
      <guid>https://dev.to/idkjs/opam-pnpm-node-esy-docker-reactnative-on-128gb-mac-o5h</guid>
      <description>&lt;p&gt;image is borrowed from &lt;a href="https://rietta.com/blog/encrypted-drive-and-docker/"&gt;rietti.com&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem
&lt;/h1&gt;

&lt;p&gt;I have hit a hard wall trying to develop with OCaml/ReasonML/Docker/Esy etc. This stack will get you fast app but the build environment is brutally disk space heavy.&lt;/p&gt;

&lt;p&gt;I had a bunch of scripts that clean up my computer every night. The scripts deleted every React Native related file, clean the simulator out, deleted all node modules in my working directories and the &lt;code&gt;~/.esy&lt;/code&gt; and &lt;code&gt;~/.pnpm&lt;/code&gt; cache directories on my machine. I could usually get back to about 20-30GB to start my next day of coding.&lt;/p&gt;

&lt;p&gt;This worked for a while until I tried to work on a pull request on the &lt;a href="https://github.com/esy/esy/issues/1146#issuecomment-759605583"&gt;&lt;code&gt;esy/esy&lt;/code&gt;&lt;/a&gt;. Building esy got me down to about 3GB of space which makes it super slow to work on this mac.&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution (so far)
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Get a &lt;a href="https://www.samsung.com/semiconductor/minisite/ssd/product/portable/t5/"&gt;Samsung Portable SSD T5&lt;/a&gt;. After trying to figure out which drive would be best for this purpose, I ended up with this one, basically because &lt;a href="https://twitter.com/JaapFrolich"&gt;@jaapfrolich&lt;/a&gt; said so. And if he says so, then it probably right. Luckily, that was enough justification in this case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set environmental variables so that the programs eating up the disk space eat up external drive space instead.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can set the default root directories to something different for all of the above programs. The first thing I did was change the name of my ssd drive to &lt;code&gt;SSD&lt;/code&gt; because its easier to type than &lt;code&gt;Samsung Portable SSD T5&lt;/code&gt;. I then create an enviromental variable for my external drive using the fish shell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-Ux&lt;/span&gt; SSD /Volumes/SSD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then set my roots:&lt;/p&gt;

&lt;h2&gt;
  
  
  PNPM &amp;amp; NPM
&lt;/h2&gt;

&lt;p&gt;For &lt;code&gt;pnpm&lt;/code&gt;, I run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ npm config &lt;span class="nb"&gt;set &lt;/span&gt;store-dir &lt;span class="nv"&gt;$SSD&lt;/span&gt;/.pnpm-store
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ npm config &lt;span class="nb"&gt;set &lt;/span&gt;prefix &lt;span class="nv"&gt;$SSD&lt;/span&gt;/.npm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then test it on a random project to check where the &lt;code&gt;pnpm&lt;/code&gt; cache is being generated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// run &lt;span class="nb"&gt;ls &lt;/span&gt;first to see that there is no &lt;span class="sb"&gt;`&lt;/span&gt;.pnpm-store&lt;span class="sb"&gt;`&lt;/span&gt; directory
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;ls
&lt;/span&gt;Containers/       .fnm/        .opam/
Github/           .fseventsd/ .Spotlight-V100/  .npm/        .DS_Store
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ bsb &lt;span class="nt"&gt;-init&lt;/span&gt; test-pnpm-store &lt;span class="nt"&gt;-theme&lt;/span&gt; basic-reason
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cd &lt;/span&gt;test-pnpm-store 
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ pnpm i
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cd&lt;/span&gt; /Volumes/SSD
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;ls
&lt;/span&gt;Containers/       .fnm/        .opam/
Github/           .fseventsd/  .pnpm-store/
.Spotlight-V100/  .npm/        .DS_Store

 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ /Volumes/SSD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see that the &lt;code&gt;.pnpm-store&lt;/code&gt; directory was created on our external ssd drive. So that works.&lt;/p&gt;

&lt;h2&gt;
  
  
  ESY
&lt;/h2&gt;

&lt;p&gt;For &lt;a href="https://esy.sh/docs/en/esy-configuration.html"&gt;&lt;code&gt;ESY__PREFIX&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// &lt;span class="nb"&gt;set &lt;/span&gt;root &lt;span class="k"&gt;for &lt;/span&gt;esy.
/Volumes/SSD
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-Ux&lt;/span&gt; ESY__PREFIX &lt;span class="nv"&gt;$SSD&lt;/span&gt;/.esy
/Volumes/SSD
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$ESY__PREFIX&lt;/span&gt;
/Volumes/SSD/.esy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wanted to use &lt;code&gt;.esyrc&lt;/code&gt; because it seems cleaner but I could not get it to work.&lt;/p&gt;

&lt;h2&gt;
  
  
  OPAM
&lt;/h2&gt;

&lt;p&gt;For &lt;a href="https://discuss.ocaml.org/t/using-ocaml-compiler-from-external-drive/7122/3?u=idkjs"&gt;&lt;code&gt;OPAMROOT&lt;/code&gt;&lt;/a&gt;. There are apparently a few ways to do this per the &lt;a href="https://opam.ocaml.org/doc/man/opam-env.html"&gt;man-pages&lt;/a&gt; but I could not get them to work so for now we stick with &lt;a href="https://twitter.com/etiennemillon"&gt;@etiennemillon&lt;/a&gt;'s suggestion on &lt;a href="https://discuss.ocaml.org/t/using-ocaml-compiler-from-external-drive/7122/3?u=idkjs"&gt;&lt;code&gt;discuss.ocaml.org&lt;/code&gt;&lt;/a&gt;. Thank you &lt;a href="https://twitter.com/etiennemillon"&gt;@etiennemillon&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Be sure to run &lt;code&gt;opam init&lt;/code&gt; after you have set the root.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// &lt;span class="nb"&gt;set &lt;/span&gt;opam root
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜set &lt;span class="nt"&gt;-Ux&lt;/span&gt; OPAMROOT &lt;span class="nv"&gt;$SSD&lt;/span&gt;/.opam
~/Downloads took 2m 52s 87ms
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$OPAMROOT&lt;/span&gt;
/Volumes/SSD/.opam
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ opam init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  FNM
&lt;/h2&gt;

&lt;p&gt;I am using the excellent &lt;a href="https://github.com/Schniz/fnm"&gt;&lt;code&gt;Schniz/fnm&lt;/code&gt;&lt;/a&gt; node package manager. Mostly because I was loyal to ReasonML. Now it written in Rust but the support there is still ReasonML level friendly and responsive so, fnm it is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/galstar"&gt;&lt;code&gt;@galstar&lt;/code&gt;&lt;/a&gt;, who built fnm, &lt;a href="https://github.com/Schniz/fnm/issues/372#issuecomment-764761708"&gt;says&lt;/a&gt; that I just need to change my &lt;code&gt;fish.config&lt;/code&gt; to source the directory where I want the cache to be with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.config/fish/config.fish
fnm &lt;span class="nb"&gt;env&lt;/span&gt; &lt;span class="nt"&gt;--fnm-dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SSD&lt;/span&gt;&lt;span class="s2"&gt;/.fnm"&lt;/span&gt; | &lt;span class="nb"&gt;source&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DOCKER
&lt;/h2&gt;

&lt;p&gt;For Docker, make a directory on your ssd for Docker to use to store images and whatever else it stores. Here I have named it &lt;code&gt;Containers&lt;/code&gt; because that is what &lt;a href="https://rietta.com/blog/encrypted-drive-and-docker/"&gt;@frankrietta&lt;/a&gt;'s &lt;a href="https://rietta.com/blog/encrypted-drive-and-docker/"&gt;rietta.com&lt;/a&gt; almost right on point blog post says. The blog doesn't use Macos Catalina but its totally worth the read anyway.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/Volumes/SSD
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;mkdir&lt;/span&gt; /Volumes/SSD/Containers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming you have already installed Docker, open the dashboard:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--moyfkTwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k7x2hf3wdo79jshaauz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--moyfkTwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k7x2hf3wdo79jshaauz8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the settings icon to the left of the &lt;code&gt;upgrade&lt;/code&gt; button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZDpnx_Zk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jc4olffut73zyhn8d04p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZDpnx_Zk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jc4olffut73zyhn8d04p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then the resources tab in the menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QmTs7QFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/moufa6q636l5nm79y3sf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QmTs7QFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/moufa6q636l5nm79y3sf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then change the &lt;code&gt;disk image location&lt;/code&gt; directory to the directory you created above.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2TDBLvHC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rhfmlgpz8cetgcqc79cr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2TDBLvHC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rhfmlgpz8cetgcqc79cr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you click apply changes, you should be good to go.&lt;/p&gt;

&lt;p&gt;Now lets test it by running some random project that uses all these build tools. For that I'll use &lt;a href="https://twitter.com/davesnx"&gt;@davesnx&lt;/a&gt;'s &lt;a href="https://github.com/reason-in-barcelona/async"&gt;&lt;code&gt;reason-in-barcelona/async&lt;/code&gt;&lt;/a&gt;. I am going to clone it to a folder not on my ssd to see how this goes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ git clone https://github.com/reason-in-barcelona/async.git reason-in-barcelona
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cd &lt;/span&gt;reason-in-barcelona/
direnv: loading ~/Downloads/reason-in-barcelona/.envrc
direnv: &lt;span class="nb"&gt;export&lt;/span&gt; +ASYNC_PG_PORT +DATABASE_URL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project requires &lt;a href="https://github.com/watchexec/watchexec"&gt;watchexec&lt;/a&gt; and &lt;a href="https://direnv.net"&gt;direnv&lt;/a&gt; so make sure you have those installed.&lt;/p&gt;

&lt;p&gt;Now let's run &lt;a href="https://github.com/reason-in-barcelona/async/blob/cdeed4abb5d5ddb4886491dd12c9e7338424c678/Makefile#L17"&gt;&lt;code&gt;make dev&lt;/code&gt;&lt;/a&gt; from the &lt;code&gt;Makefile&lt;/code&gt; and see if this worked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ make dev
...
∗ installed core.v0.14.0
Done.
&lt;span class="c"&gt;# Run eval (opam env) to update the current shell environment&lt;/span&gt;
opam &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; ocaml-lsp-server dune

&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; Synchronising pinned packages &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  🐫
&lt;span class="o"&gt;[&lt;/span&gt;ocaml-lsp-server.dev] no changes from git+https://github.com/ocaml/ocaml-lsp.git#HEAD

&lt;span class="o"&gt;[&lt;/span&gt;NOTE] Package dune is already installed &lt;span class="o"&gt;(&lt;/span&gt;current version is 2.8.2&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;NOTE] Package ocaml-lsp-server is already installed &lt;span class="o"&gt;(&lt;/span&gt;current version is dev&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="c"&gt;# Install the dependencies&lt;/span&gt;
opam &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--deps-only&lt;/span&gt; &lt;span class="nt"&gt;--with-doc&lt;/span&gt; &lt;span class="nt"&gt;--with-test&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
Nothing to &lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;# Run eval (opam env) to update the current shell environment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That looks like it worked, thankfully. Let see what happens when we try to build the local db with docker by running &lt;code&gt;docker-compose -f docker-compose.dev.yml up -d&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.dev.yml up &lt;span class="nt"&gt;-d&lt;/span&gt;
reason-in-barcelona on  main is 📦 v0.1.0 via ⬢ v14.15.4 is 🐳 v20.10.2
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.dev.yml up &lt;span class="nt"&gt;-d&lt;/span&gt;
Creating network &lt;span class="s2"&gt;"reason-in-barcelona_default"&lt;/span&gt; with the default driver
Creating volume &lt;span class="s2"&gt;"reason-in-barcelona_db-data"&lt;/span&gt; with default driver
Creating volume &lt;span class="s2"&gt;"reason-in-barcelona_pgadmin-data"&lt;/span&gt; with default driver
Pulling db &lt;span class="o"&gt;(&lt;/span&gt;postgres:12.2&lt;span class="o"&gt;)&lt;/span&gt;...
12.2: Pulling from library/postgres
54fec2fa59d0: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;30a95add0890: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;57bc798d3c84: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;a41bedb2c5de: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;589548c3abb4: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;c4c6b75d5deb: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;8f8c045a6a99: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;69f9dd86b24d: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;45bbaba740ff: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;1761ca7befa0: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;57feb34018f4: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;bede8373accc: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;6e4c69fbe63b: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;8a7949704ab2: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;Digest: sha256:d96835c9032988c8a899cb8a3c54467dae81daaa99485de70e8c9bddd5432d92
Status: Downloaded newer image &lt;span class="k"&gt;for &lt;/span&gt;postgres:12.2
Pulling pgadmin &lt;span class="o"&gt;(&lt;/span&gt;dpage/pgadmin4:4.18&lt;span class="o"&gt;)&lt;/span&gt;...
4.18: Pulling from dpage/pgadmin4
89d9c30c1d48: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;910c49c00810: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;7efe415eb85a: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;7d8d53519b81: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;519124ac136c: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;fbfa5cf626f8: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;f53a64187e16: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;feae0c230730: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;87ae2307a1ad: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;0a609eb1a1ca: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;b8bb05efc354: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;bccaa4da228f: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;084101fb937a: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;774874c72d7a: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;45a1fa7f66b7: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;b19cea40abf6: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;76e3d6803955: Pull &lt;span class="nb"&gt;complete
&lt;/span&gt;Digest: sha256:1141073018353f91953c1523f170821e139dbd1c2d7808d3804962b2ba7e89e3
Status: Downloaded newer image &lt;span class="k"&gt;for &lt;/span&gt;dpage/pgadmin4:4.18
Creating reason-in-barcelona_db_1 ... &lt;span class="k"&gt;done
&lt;/span&gt;Creating reason-in-barcelona_pgadmin_1 ... &lt;span class="k"&gt;done

&lt;/span&gt;reason-in-barcelona on  main is 📦 v0.1.0 via ⬢ v14.15.4 is 🐳 v20.10.2 took 1m 3s 441ms
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That also works! And my primary disk space is unaffected. Big win.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Esy
&lt;/h2&gt;

&lt;p&gt;I guess I should have said go get a coffee because the previous steps take so long. You have to pay for the fast and typed end product by taking the time to install your ocaml build env...&lt;/p&gt;

&lt;p&gt;As I ran that command I realized that the project doesn't use &lt;code&gt;esy&lt;/code&gt; so I am going run the &lt;a href="https://esy.sh/docs/en/getting-started.html#clone-initialize-the-project"&gt;quickstart&lt;/a&gt; steps from the &lt;a href="https://esy.sh"&gt;esy.sh&lt;/a&gt; to test the esy setup.&lt;/p&gt;

&lt;p&gt;Since I deleted my &lt;code&gt;.fnm&lt;/code&gt; before I started this process I am going I need to reinstall esy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ npm i &lt;span class="nt"&gt;-g&lt;/span&gt; esy@next
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ git clone https://github.com/esy-ocaml/hello-reason.git
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cd &lt;/span&gt;hello-reason
hello-reason on  master is 📦 v0.1.0 via ⬢ v14.15.4
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ esy
fish: Unknown &lt;span class="nb"&gt;command&lt;/span&gt;: esy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running &lt;code&gt;esy&lt;/code&gt; does not work. Apparently, my environment does not know that it is there. Anyone know what is going on here? I have posted this in the discussion for &lt;code&gt;esy@next&lt;/code&gt; &lt;a href="https://github.com/esy/esy/discussions/1254#discussioncomment-304788"&gt;here&lt;/a&gt;. I will get back to you all when I figure this out.&lt;/p&gt;

&lt;p&gt;Update:&lt;/p&gt;

&lt;p&gt;I used my trusty go to debugging method, just trying stuff, which got us esy working. At the very beginning, I got cute and ran &lt;code&gt;npm config set prefix $SSD/.npm&lt;/code&gt; which resulted in out &lt;code&gt;$HOME/.npmrc&lt;/code&gt; file looking like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;store-dir&lt;span class="o"&gt;=&lt;/span&gt;/Volumes/SSD/.pnpm-store
&lt;span class="nv"&gt;prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/Volumes/SSD/.npm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I read the output from &lt;code&gt;npm i -g @esy@next&lt;/code&gt; I saw a bunch of symlinks. I have learned the hard way over the years that &lt;code&gt;symlinks&lt;/code&gt; are not always your friend. I removed &lt;code&gt;prefix=/Volumes/SSD/.npm&lt;/code&gt; from &lt;code&gt;.npmrc&lt;/code&gt;, ran &lt;code&gt;npm i -g esy@next&lt;/code&gt; again, then running &lt;code&gt;esy&lt;/code&gt; in the &lt;code&gt;hello-reason&lt;/code&gt; directory worked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hello-reason on  master is 📦 v0.1.0 via ⬢ v14.15.4
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;cat &lt;/span&gt;package.json | jq &lt;span class="s1"&gt;'.scripts'&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"test"&lt;/span&gt;: &lt;span class="s2"&gt;"esy x Hello"&lt;/span&gt;,
  &lt;span class="s2"&gt;"format"&lt;/span&gt;: &lt;span class="s2"&gt;"esy dune build @fmt --auto-promote"&lt;/span&gt;,
  &lt;span class="s2"&gt;"doc"&lt;/span&gt;: &lt;span class="s2"&gt;"esy dune build @doc"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

hello-reason on  master is 📦 v0.1.0 via ⬢ v14.15.4
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ esy &lt;span class="nb"&gt;test
&lt;/span&gt;Running Test Program:
Hello, World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your run &lt;code&gt;ls&lt;/code&gt; in your external volume, you will see that that esy is using it to cache files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/Volumes/SSD
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;ls
&lt;/span&gt;Containers/  .Spotlight-V100/  .fnm/        .npm/   .pnpm-store/
Github/      .esy/             .fseventsd/  .opam/  .DS_Store

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I should probably delete the &lt;code&gt;.npm&lt;/code&gt; dir.&lt;/p&gt;

&lt;p&gt;Let see if there are any other issues. I find that there is usually some quirk that show up later on so I am sure I will be back.&lt;/p&gt;

&lt;h2&gt;
  
  
  XCode
&lt;/h2&gt;

&lt;p&gt;XCode is the master of all disk space hoarders. Dealing with XCode and Esy/OCaml's disk space was the point of this excersize and when I went to use this set up, I realized I had forgotten about Xcode.&lt;/p&gt;

&lt;p&gt;This is what I did to get this going.&lt;/p&gt;

&lt;p&gt;First, read this stackoverflow issue -&amp;gt; &lt;a href="https://stackoverflow.com/questions/59159232/can-i-install-xcode-on-an-external-hard-drive-along-with-the-iphone-simulator-ap/65683543#comment116453766_65683543"&gt;https://stackoverflow.com/questions/59159232/can-i-install-xcode-on-an-external-hard-drive-along-with-the-iphone-simulator-ap/65683543#comment116453766_65683543&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a bunch of good bits in there though the author says he doesnt vouch for it with XCode 12.&lt;/p&gt;

&lt;p&gt;Here is how I did it for XCode 12.&lt;/p&gt;

&lt;p&gt;Go to &lt;code&gt;https://developer.apple.com/download/more/?q=xcode&lt;/code&gt;, sign in if you have to and select the version of XCode you want. I selected the latest stable version which was &lt;code&gt;XCode12.3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iqMeZDD4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a0k5yx6sof2nqsc8odio.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iqMeZDD4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a0k5yx6sof2nqsc8odio.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have space issue, which is why you are reading this, you will want to download this to your ssd. I set my browser download location to my SSD drive and double clicked on &lt;code&gt;XCode12.3.zip&lt;/code&gt;. This takes a while as you know.&lt;/p&gt;

&lt;p&gt;I then deleted the old XCode with CleanMyMac. You can do without it from the terminal with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/Library/Developer/Xcode
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; /Applications/Xcode.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you want to symlink Xcode from your ssd to your &lt;code&gt;~/Applications&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /Volumes/SSD/Applications/Xcode.app /Applications/Xcode.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up the simulator by &lt;/p&gt;

&lt;p&gt;Important! Double Click XCode to open it so that it prompts you accept the license. If you dont do this, when you have symlinked the simulator it will just silently shutdown.&lt;/p&gt;

&lt;p&gt;After you have accepted the license you can close Xcode which will have opened.&lt;/p&gt;

&lt;p&gt;Tell XCode which &lt;code&gt;XCode&lt;/code&gt; to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ &lt;span class="nb"&gt;sudo &lt;/span&gt;xcode-select &lt;span class="nt"&gt;--switch&lt;/span&gt; /Volumes/SSD/Applications/Xcode.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tell XCode which &lt;code&gt;xcode-select&lt;/code&gt; to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;xcode-select &lt;span class="nt"&gt;-s&lt;/span&gt; /Volumes/SSD/Applications/Xcode.app/Contents/Developer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up the simulator by aliasing the simulator on your ssd into your applications. I am only using the IPhone simulator so I did the following. Go to the &lt;code&gt;Simulator&lt;/code&gt; on your ssd which should be at &lt;code&gt;/Volumes/SSD/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app&lt;/code&gt;. Right click it and select &lt;code&gt;Make Alias&lt;/code&gt;:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9H1-x5hb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/38y1ybvr5ynlc6zkapb1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9H1-x5hb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/38y1ybvr5ynlc6zkapb1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy/Drag that to &lt;code&gt;~/Applications&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N9eLElic--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4exr4xzcb2y4etwo5i6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N9eLElic--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4exr4xzcb2y4etwo5i6c.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if you go into some project and run &lt;code&gt;react-native run-ios&lt;/code&gt; it should be good to go.&lt;/p&gt;

&lt;p&gt;I hope this help you all with limited disk space trying to do too much with your limited tools like I am.&lt;/p&gt;

&lt;p&gt;You can also set a custom path for &lt;code&gt;Library/Developer/Xcode/DerivedData&lt;/code&gt; and &lt;code&gt;Library/Developer/Xcode/Archives&lt;/code&gt; via Xcode -&amp;gt; Preferences -&amp;gt; Locations. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jcDiqAZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zhoa2oq488tr350tejq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jcDiqAZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zhoa2oq488tr350tejq7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now download the version you might need via Xcode -&amp;gt; Preferences -&amp;gt; Components or via the Xcode app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EKrbqNJA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhofl0hhbuu3c1g81hvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EKrbqNJA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhofl0hhbuu3c1g81hvu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hopefully these are now being installed in our custom directory on our external SSD.&lt;/p&gt;

&lt;p&gt;This also seems to work: &lt;a href="https://www.simpleswiftguide.com/how-to-add-missing-iphone-se-simulator-in-xcode-11-with-ios-13-sdks/"&gt;https://www.simpleswiftguide.com/how-to-add-missing-iphone-se-simulator-in-xcode-11-with-ios-13-sdks/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stay tuned.&lt;/p&gt;

&lt;h1&gt;
  
  
  Other Tips
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;installing xcode command line tools. Get it from here -&amp;gt; &lt;a href="https://developer.apple.com/download/more/"&gt;https://developer.apple.com/download/more/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;accepting the license in terminal &lt;code&gt;sudo xcodebuild license&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;great resource: &lt;a href="https://wilsonmar.github.io/xcode/#InstallIDE"&gt;https://wilsonmar.github.io/xcode/#InstallIDE&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;great resource on installing simulators versions:&lt;a href="https://suelan.github.io/2020/02/05/iOS-Simulator-from-the-Command-Line/"&gt;https://suelan.github.io/2020/02/05/iOS-Simulator-from-the-Command-Line/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fix macos LibreSSL vs openssl xcode react-native issue with &lt;a href="https://yasar-yy.medium.com/installing-openssl-library-on-macos-catalina-6777a2e238a6"&gt;https://yasar-yy.medium.com/installing-openssl-library-on-macos-catalina-6777a2e238a6&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>esy</category>
      <category>reason</category>
      <category>docker</category>
      <category>xcode</category>
    </item>
    <item>
      <title>Beating the Drom</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Sun, 10 Jan 2021 12:42:31 +0000</pubDate>
      <link>https://dev.to/idkjs/beating-the-drom-70k</link>
      <guid>https://dev.to/idkjs/beating-the-drom-70k</guid>
      <description>&lt;p&gt;Learning to use the &lt;a href="https://ocamlpro.github.io/drom/"&gt;&lt;code&gt;Drom&lt;/code&gt;&lt;/a&gt; build system for ocam/reasonml projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is a port of for starting &lt;a href="https://github.com/spencerwi/now.ml"&gt;now.ml&lt;/a&gt; project to &lt;a href="https://reasonml.github.io/"&gt;reasonml&lt;/a&gt; using &lt;code&gt;drom&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It took nothing at all to compile with reason. Apparently, &lt;code&gt;drom&lt;/code&gt; is aware of reason syntax files. This is a really nice addition to the options for building with reason/ocaml and might be my go to option to start a project. Thanks to the folks at &lt;a href="https://github.com/OCamlPro?type=source"&gt;&lt;code&gt;OCamlPro&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Examples
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;now minus 1 hour

&lt;span class="nv"&gt;$ &lt;/span&gt;now minus 5 days
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  From Scratch
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ opam &lt;span class="nb"&gt;install &lt;/span&gt;drom
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ drom new now
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ drom build &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ ./now
2021-01-10T13:18:18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Installing on your system
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;I] ➜ drom &lt;span class="nb"&gt;install
&lt;/span&gt;Warning: drom is not correctly installed &lt;span class="k"&gt;in &lt;/span&gt;this switch:
/Users/mandalarian/Downloads/now/_opam/share/drom/skeletons is missing
Warning: could not load skeletons from share/drom/skeletons/project
Warning: could not load skeletons from share/drom/skeletons/package
drom: Entering directory &lt;span class="s1"&gt;'/Users/mandalarian/Downloads/now'&lt;/span&gt;
In opam switch /Users/mandalarian/Downloads/now/_opam
Warning: could not load licenses from share/drom/licenses
Calling git submodule update &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="nt"&gt;--recursive&lt;/span&gt;
Calling opam &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; dune build @install
Done: 65/71 &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;jobs&lt;/span&gt;: 1&lt;span class="o"&gt;)&lt;/span&gt;Calling opam uninstall &lt;span class="nt"&gt;-y&lt;/span&gt; now
&lt;span class="o"&gt;[&lt;/span&gt;ERROR] now unknown package
Calling opam uninstall &lt;span class="nt"&gt;-y&lt;/span&gt; now_lib
&lt;span class="o"&gt;[&lt;/span&gt;ERROR] now_lib unknown package
Calling opam pin &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;--no-action&lt;/span&gt; &lt;span class="nt"&gt;-k&lt;/span&gt; path &lt;span class="nb"&gt;.&lt;/span&gt;
This will pin the following packages: now_lib, now. Continue?
&lt;span class="o"&gt;[&lt;/span&gt;Y/n] y
Package now_lib does not exist, create as a NEW package?
&lt;span class="o"&gt;[&lt;/span&gt;Y/n] y
&lt;span class="o"&gt;[&lt;/span&gt;now_lib.~dev] synchronised from file:///Users/mandalarian/Downloads/now
&lt;span class="o"&gt;[&lt;/span&gt;WARNING] Failed checks on now_lib package definition from
          &lt;span class="nb"&gt;source &lt;/span&gt;at file:///Users/mandalarian/Downloads/now:
  warning 35: Missing field &lt;span class="s1"&gt;'homepage'&lt;/span&gt;
  warning 36: Missing field &lt;span class="s1"&gt;'bug-reports'&lt;/span&gt;
now_lib is now pinned to file:///Users/mandalarian/Downloads/now &lt;span class="o"&gt;(&lt;/span&gt;version 0.1.0&lt;span class="o"&gt;)&lt;/span&gt;
Package now does not exist, create as a NEW package? &lt;span class="o"&gt;[&lt;/span&gt;Y/n] y
&lt;span class="o"&gt;[&lt;/span&gt;now.~dev] synchronised from file:///Users/mandalarian/Downloads/now
&lt;span class="o"&gt;[&lt;/span&gt;WARNING] Failed checks on now package definition from &lt;span class="nb"&gt;source
          &lt;/span&gt;at file:///Users/mandalarian/Downloads/now:
  warning 35: Missing field &lt;span class="s1"&gt;'homepage'&lt;/span&gt;
  warning 36: Missing field &lt;span class="s1"&gt;'bug-reports'&lt;/span&gt;
now is now pinned to file:///Users/mandalarian/Downloads/now &lt;span class="o"&gt;(&lt;/span&gt;version 0.1.0&lt;span class="o"&gt;)&lt;/span&gt;
Calling opam &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; now now_lib

&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; Synchronising pinned packages &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  🐫
&lt;span class="o"&gt;[&lt;/span&gt;now.0.1.0] synchronised from file:///Users/mandalarian/Downloads/now
&lt;span class="o"&gt;[&lt;/span&gt;now_lib.0.1.0] synchronised from file:///Users/mandalarian/Downloads/now

The following actions will be performed:
  ∗ &lt;span class="nb"&gt;install &lt;/span&gt;now_lib 0.1.0&lt;span class="k"&gt;*&lt;/span&gt;
  ∗ &lt;span class="nb"&gt;install &lt;/span&gt;now     0.1.0&lt;span class="k"&gt;*&lt;/span&gt;
&lt;span class="o"&gt;=====&lt;/span&gt; ∗ 2 &lt;span class="o"&gt;=====&lt;/span&gt;

&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; Processing actions &amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  🐫
∗ installed now_lib.0.1.0
∗ installed now.0.1.0
Done.

Installation OK

&lt;span class="c"&gt;# open a new terminal and run `which now`&lt;/span&gt;
&lt;span class="c"&gt;# now is installed at /Users/mandalarian/.local/bin/now&lt;/span&gt;
now on  reason &lt;span class="o"&gt;[&lt;/span&gt;✘!?] via ⬢ v14.4.0
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ which now
/Users/mandalarian/.local/bin/now

 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ now
2021-01-10T13:28:27

/ 
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ now minus 1 hour
2021-01-10T12:28:28

/ 
 &lt;span class="o"&gt;[&lt;/span&gt;I] ➜ now minus 5 days
2021-01-05T13:28:39
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/idkjs/now"&gt;repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reason</category>
      <category>ocaml</category>
      <category>drom</category>
      <category>dune</category>
    </item>
    <item>
      <title>Fixing `Deprecated: React.Ref.setCurrent`</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Tue, 05 Jan 2021 13:35:23 +0000</pubDate>
      <link>https://dev.to/idkjs/fixing-deprecated-react-ref-setcurrent-p9d</link>
      <guid>https://dev.to/idkjs/fixing-deprecated-react-ref-setcurrent-p9d</guid>
      <description>&lt;p&gt;I keep finding myself having looking this up so I'm writing this note to myself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bad Code
&lt;/h3&gt;

&lt;p&gt;This code throws a warning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let useIsMounted = () =&amp;gt; {
  let ref = React.useRef(false);

  React.useEffect0(() =&amp;gt; {
    ref-&amp;gt;React.Ref.setCurrent(true);
    Some(() =&amp;gt; ref-&amp;gt;React.Ref.setCurrent(false));
  });
  ref;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Warning
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning 3: deprecated: React.Ref.setCurrent
Please directly assign to ref.current insteadocamllsp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Fix
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://reasonml.github.io/reason-react/"&gt;ReasonML/Reason-React&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let useIsMounted = () =&amp;gt; {
  let ref = React.useRef(false);

  React.useEffect0(() =&amp;gt; {
    ref.current = true;
    Some(() =&amp;gt; ref.current = false);
  });
  ref;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;a href="https://rescript-lang.org/"&gt;Rescript&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let useIsMounted = () =&amp;gt; {
  let ref = React.useRef(false)

  React.useEffect0(() =&amp;gt; {
    ref.current = true
    Some(() =&amp;gt; ref.current = false)
  })
  ref
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, they are the same except for the commas which the compiler will remove for you anyway.&lt;/p&gt;

</description>
      <category>reason</category>
      <category>rescript</category>
      <category>bucklescript</category>
    </item>
    <item>
      <title>npx bsconfig.json</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Thu, 19 Nov 2020 09:44:15 +0000</pubDate>
      <link>https://dev.to/idkjs/npx-bsconfig-json-2d0e</link>
      <guid>https://dev.to/idkjs/npx-bsconfig-json-2d0e</guid>
      <description>&lt;h1&gt;
  
  
  bsconfig.json
&lt;/h1&gt;

&lt;p&gt;I've been annoyed by writing or createing new &lt;code&gt;bsconfig.json&lt;/code&gt; files for projects that may not have started out as &lt;code&gt;reasonml&lt;/code&gt; or &lt;code&gt;ocaml&lt;/code&gt; projects, especially when using &lt;code&gt;reason-apollo-client&lt;/code&gt; and &lt;code&gt;graphql-ppx&lt;/code&gt; projects. So, inspired by the greate &lt;a href="https://twitter.com/benawad"&gt;@benawad&lt;/a&gt; who teaches at &lt;a href="https://www.youtube.com/benawad97"&gt;youtube/benawad97&lt;/a&gt; and his &lt;a href="https://github.com/benawad/tsconfig.json"&gt;tsconfig.json&lt;/a&gt; project, I created myself this utility. Check it out if you are like me and just want to remove the friction of creating a new &lt;code&gt;bsconfig.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;npx bsconfig.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vx09FBZw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q5oiit8tnhh95gsm7d34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vx09FBZw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q5oiit8tnhh95gsm7d34.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/idkjs/bsconfig.json/blob/master/README.md"&gt;idkjs/bsconfig.json&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reason</category>
      <category>rescript</category>
      <category>ocaml</category>
    </item>
    <item>
      <title>Noop in ReasonML</title>
      <dc:creator>Alain</dc:creator>
      <pubDate>Fri, 23 Oct 2020 08:21:16 +0000</pubDate>
      <link>https://dev.to/idkjs/noop-in-reasonml-43o8</link>
      <guid>https://dev.to/idkjs/noop-in-reasonml-43o8</guid>
      <description>&lt;p&gt;Note to self on where those explanations where on the purpose of &lt;code&gt;noop&lt;/code&gt; functions in ReasonML.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://discord.com/channels/235176658175262720/235176658175262720/768734335552978959"&gt;https://discord.com/channels/235176658175262720/235176658175262720/768734335552978959&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reason</category>
      <category>notetoself</category>
      <category>noop</category>
    </item>
  </channel>
</rss>
