hmemcpy / milewski-ctfp-pdf

Bartosz Milewski's 'Category Theory for Programmers' unofficial PDF and LaTeX source
https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
Other
10.91k stars 581 forks source link

Interest in adding OCaml code snippets in addition to scala and haskell #169

Open ArulselvanMadhavan opened 5 years ago

ArulselvanMadhavan commented 5 years ago

Hello,

Thanks for this wonderful resource. After the support for scala was added to the book, it just got me thinking whether it'd be useful to also add OCaml snippets in the book. I just started reading the book and I am also learning OCaml in my free time. So, I am also interested in contributing towards this initiative if it gets enough traction. Anyway, the purpose of this issue is to see if there is any interest.

mseri commented 5 years ago

I have been thinking about it as well. I have no time at the moment, but it is on my todo list. I would be happy to review them if you plan to prepare them and need a reviewer

Leonidas-from-XIV commented 5 years ago

This sounds very cool. Since I just got the book I might be looking into translating the code as I go along too, but it usually takes me an eternity so I'm happy if someone beats me to it!

hmemcpy commented 5 years ago

This is a fantastic idea! There are already 2 efforts I know of translating the snippets to Kotlin and Swift. An OCaml edition would be most welcomed, judging by the tweet :)

That said, I don't really know OCaml, so my advice would be setting up a repo and do the translations there. Hopefully there exists a tool for OCaml similar to Scala's tut (or Kotlin's ank) that can perform compile-time verification of code snippets in markdown files. Then, you could create markdown files with both code snippets (Haskell and OCaml), and make sure they typecheck.

I'd be happy to accept a PR (or, at least, a ping) when such effort is underway. Good luck! :)

XVilka commented 5 years ago

@hmemcpy yes, there is - see mdx which is used in Real World OCaml book.

ArulselvanMadhavan commented 5 years ago

Thanks @hmemcpy for the tweet and suggestions on the next step. I will start working on this project soon and update this thread.

mseri commented 5 years ago

@ArulselvanMadhavan I have collected some materal that may help you in the quest.

The following packages have nice "higher order" structure implementations: https://github.com/IndiscriminateCoding/clarity, https://github.com/BinaryAnalysisPlatform/bap/tree/master/lib/monads

The following blog or forum posts may be relevant: https://ocamlverse.github.io/content/learning.html#monads, https://discuss.ocaml.org/t/modular-implicits/144/61, https://discuss.ocaml.org/t/critique-of-implicits/3031/59

Expect the OCaml implementation to be more verbose.

If you need any help just give me a shout, or ask on the discuss.ocaml.org forum or the discord channel, they are very active.

ArulselvanMadhavan commented 5 years ago

@mseri I have started my work on this. I have the snippets for chapter 1. I'd appreciate if you could review it and let me know if something could be done in a better way so that I can correct them sooner than later.

https://github.com/ArulselvanMadhavan/ocaml-ctfp/blob/master/chapter1/chapter1.md

cc:@hmemcpy

mseri commented 5 years ago

@ArulselvanMadhavan sure, where should I look?

ArulselvanMadhavan commented 5 years ago

@mseri - I added the link to my earlier comment a little late. Here it is - https://github.com/ArulselvanMadhavan/ocaml-ctfp/blob/master/chapter1/chapter1.md

ArulselvanMadhavan commented 5 years ago

Hi @mseri, When you have some time, can you review the snippets for chapters 2 - 5? https://github.com/ArulselvanMadhavan/ocaml-ctfp

mseri commented 5 years ago

Done :) Sorry for the long silence

ArulselvanMadhavan commented 5 years ago

@mseri I have the chapter 6 ready for review, when you have some time. Do you prefer reviewing multiple chapters at once or one at a time?

XVilka commented 5 years ago

@ArulselvanMadhavan maybe at this point it worth to send a draft/WIP PR here? Will give your project more visibility.

ArulselvanMadhavan commented 5 years ago

@XVilka Sure. I'd like to get more eyes on my work as well. @hmemcpy Is it Ok if I submit a WIP PR to this repo? I have snippets upto chapter 7.

Link to my repo: https://github.com/ArulselvanMadhavan/ocaml-ctfp

ArulselvanMadhavan commented 5 years ago

@mseri Chapter 7 is also ready for review. https://github.com/ArulselvanMadhavan/ocaml-ctfp/tree/master/chapter7

mseri commented 5 years ago

I have started the 6, I will go on this weekend and hopefully send you some updated soon. I think @XVilka suggestion is not bad, it is even easier to give feedback on a pull request, and we can enable notifications to get updated if new chapters are added

hmemcpy commented 5 years ago

Looking good! I admit I haven't touched the book in a while, I need to see if my setup still works 😅

Thank you for the effort! I'll look into it.

ArulselvanMadhavan commented 5 years ago

@mseri Chapter 8 is also ready for review, when you have time. https://github.com/ArulselvanMadhavan/ocaml-ctfp/blob/master/chapter8/README.md

Since my branch is not fork of this repo, I am not able to submit a PR from my repo. I don't know how to build the book from this repo but I am working on figuring it out.

EDIT: Chapter 9 is also ready for review. https://github.com/ArulselvanMadhavan/ocaml-ctfp/blob/master/chapter9/README.md

ArulselvanMadhavan commented 5 years ago

@mseri FYI. Chapter 10 is also ready for review.

mseri commented 5 years ago

Thanks, I'll try to have a look as soon as possible!

XVilka commented 5 years ago

@ArulselvanMadhavan you might also find this information useful http://blog.shaynefletcher.org/2017/05/more-type-classes-in-ocaml.html and Monads, Applicatives, etc from Base library https://ocaml.janestreet.com/ocaml-core/latest/doc/base/Base/

rtviii commented 1 year ago

Thanks for your work @ArulselvanMadhavan