reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.14k stars 430 forks source link

Real World Reason #1356

Closed ShalokShalom closed 3 months ago

ShalokShalom commented 7 years ago

I like to convert the OCaml reference "Real World OCaml" with refmt into a Real World Reason, meaning that all the examples get automatically transcompiled into Reason.

And is there anything else to consider? Any news? Other changes? Its from 2013, so some things might have happen in the meanwhile, is anybody aware of it?

bassjacob commented 7 years ago

I believe there is already an effort underway both to modernise Real World OCaml and to offer it with Reason syntax.

ShalokShalom commented 7 years ago

Where can I find more info about it?

pjhenning commented 7 years ago

WIP second edition is here: http://dev.realworldocaml.org

avsm commented 7 years ago

We'll be open sourcing the book repository soon along with the tooling, so I'll post on https://discuss.ocaml.org when that happens. Contributions such as Reason support are very welcome.

avsm commented 7 years ago

A good point of contact for Reason support is @SanderSpies, as he is working on some of the tooling around RWOv2

ShalokShalom commented 7 years ago

@avsm So, i can simply transform all the examples with refmt and adjust the text, that's it? Seems like something very easy, even doable for someone unskilled like me :P

Thanks a lot

ShalokShalom commented 7 years ago

@avsm Is there any blocker for the release?

jordwalke commented 7 years ago

@shalokshalom yes it should be that easy. But the question is, will RWO'a license allow this?

ShalokShalom commented 7 years ago

which licence is it?

SanderSpies commented 7 years ago

It will be OSS soonish, the focus currently is on OCaml though. If people are interested in helping with Reason support, a good place would be the ocaml-gist tool that I'm working on. It works with the Reason parser but I haven't had time to actually add it.

If you are interested in helping with this ping me on Discord.

On Aug 30, 2017 7:46 PM, "ShalokShalom" notifications@github.com wrote:

which licence is it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/reason/issues/1356#issuecomment-326083312, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEABTLfVJki5-eiQcpMQYmG8SOmGnMoks5sda4RgaJpZM4Oxq6b .

ShalokShalom commented 7 years ago

I am a newbie and thought simply putting it into refmt is enough.

ShalokShalom commented 6 years ago

Is there any news?

jordwalke commented 6 years ago

I believe the main issue is still RWO’s license prohibiting modification of the text.

Huxpro commented 6 years ago

Hey folks. I was experimenting on this: https://real-world-reason.gitbook.io/book/ (the links are currently un-listed/un-indexable, so only people know the link can preview)

The goal of this project is to comment on "Real World OCaml" with Reason hints, and provide Reason codes to complement the OCaml codes. I hope it can be helpful to people like me (who want to learn OCaml/Reason at the same time) while not violating RWO's CC license. It can be also treated as a preparation work for future upstreaming to RWO v2. @avsm, could you share your opinion on this?

The main concern here is still the lisence issue. My main strategy was to Keep "Real World OCaml" text untouched in any case but take advantage of Gitbook's style to provide Reason hints and Reason code in Tabs (so you can switch between OCaml and Reason) . Please check out the conversion guide and completed chapter-2 to see if it's viable and how readiable this approach could be.

The main difficulties are

  1. Samples in RWO uses Jane Street's libraries (Core.std/Base etc), Reason have a different set of standard libraries (Js and Belt and Pervasive) for web. Simply refmting is far from decent. Sometimes I need to tweak or even come out my own sample to provide the same knowledge.
  2. Samples in RWO are demonstrated with utop to provide an interactive education experience, while rtop has issues accessing Js and Belt and the fact that replay requiring Js.log make it can not log data structure in the Reason form. So my conversion was mixing the usage of rtop and replay, which is awkward in many cases.
  3. In some case, Reason's variance can partialy/completely bypass RWO. Which need more hints provided to explain Reason's variance.

All of these made the procedure much more time-consuming than I thought.

avsm commented 6 years ago

Great work! I don't think there's a license issue if this is upstreamed eventually. cc @samoht @yminsky.

1) Seems to be a big blocker. Is the Base library supported from Reason JS? If so, most of the v2 Guided Tour should be compatible. I'm not familiar with Belt, but I assume Js is the standard library for JavaScript, and Pervasive is the same as the OCaml one.

What's the advantage of GitBook vs normal HTML output? Should we adopt Gitbook for RWOv2 as well rather than maintaining our own HTML output?

jaredly commented 6 years ago

Gitbook is a more streamlined experience, but I expect it would be harder (or maybe impossible?) to get ocaml code blocks to work the way you want.

ShalokShalom commented 6 years ago

Gitbook offers out of the box support for dark displayed content

avsm commented 6 years ago

I think we want to take the online RWO/RWR site more in the direction of an interactive notebook, so it's probably better for us to generate the HTML... if anything, heading towards a Juypter style might be best, as we already have both client- and server- side rendering for that (in OCaml anyway -- I imagine a Reason Jupyter notebook is pretty straightforward)

Huxpro commented 6 years ago

@avsm glad to hear! As Jared said, Gitbook is more streamlined thus easier for the early experimenting purpose. But it's definitely very limited. Do we have any idea how to bake RWR into RWO dev?

In terms of heading towards a Juypter-like style, http://blog.klipse.tech/ocaml/2017/10/05/blog-ocaml.html http://blog.klipse.tech/reason/2017/10/06/blog-reason.html maybe worth to look at.

avsm commented 6 years ago

We've been porting the RWO toolchain to use all the modern stuff - perhaps the first thing to do is to fork https://github.com/realworldocaml/book and generate a server-side formatting of Reason code (and add the tab option in). That won't help with the standard library issue, but it will at least get the formatting right.

We've been thinking about how to add more community-generated chapters into the online version, so this is all heading in the right direction. In fact, I wanted a JavaScript chapter in the main book for v2...

jordwalke commented 6 years ago

@avsm The license of RWO seems to present one issue.

Huxpro commented 6 years ago

Here is an update to the difficutlies I mentioned:

  1. I am glad I am wrong with this. jbuilder(dune) have supported *.re first class and linking Core.std works very well. I do have pp (refmt) version incompatible when switching back and forth between 4.02 and 4.06 to test Base. But it should works in theory. Now my main concern is that RWO might not help as much for people using Reason for Web as it does for OCaml if we simply refmt everything. But It's another story.

  2. if we wanna go with all Core/Base, then making rtop support them or making utop support .re is necessary.

ShalokShalom commented 5 years ago

A Juypter Notebook sounds super +1

Huxpro commented 5 years ago

I agreed. As far as I know, there have been several Juypter-like notebook implementations around OCaml/Reason community.

On Mon, Apr 22, 2019 at 3:23 AM ShalokShalom notifications@github.com wrote:

A Juypter Notebook sounds super +1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebook/reason/issues/1356#issuecomment-485349465, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKOHM2MP6DOQOENBAH3MM3PRVRWPANCNFSM4DWGV2NQ .

jordwalke commented 5 years ago

https://sketch.sh is a great system. It's not quite in book form, but all the pieces are there.

anmonteiro commented 3 months ago

dont think we have the manpower for this