O
OCamlPro Blog
ocamlpro.com · Company blog · on HN since 2011
OCamlPro is a company of OCaml specialists whose blog covers the language, compiler internals, garbage collection and tooling.
What HN saysHN commenters link it for the OCaml type-system Sudoku solver, the language cheatsheet, and its experience moving COBOL projects to GnuCOBOL.
30HN people shared it
10linked it in comments
37stories submitted
633story points
5 months agolast shared
2011people per year2026
Most-shared posts
- 1A look back on OCaml since 20112 people · 131 points · first shared 2019 · 28 comments on HN
- 2ASM.OCaml2 people · 6 points · first shared 2016 · discussion on HN
- 3Autofonce, GNU Autotests Revisited2 people · 5 points · first shared 2023 · discussion on HN
- 4EzSudoku [Sudoku solver encoded in OCaml type system]2 people · 3 points · first shared 2017 · discussion on HN
- 5CPS Representation and Foundational Design Decisions in Flambda22 people · 2 points · first shared 2024 · discussion on HN
- 6Facebook's Flowtype Binaries (v. 0.19.1) for Windows2 people · 1 points · first shared 2015 · discussion on HN
- 72017 04 01 ezsudoku2 people · first shared 2023
- 8An in-depth look at OCaml’s new “best-fit” garbage collector strategy1 people · 176 points · first shared 2020 · 41 comments on HN
- 92021 at OCamlPro1 people · 104 points · first shared 2022 · 23 comments on HN
- 102020 at OCamlPro1 people · 60 points · first shared 2021 · 9 comments on HN
- 11Flambda2 Ep. 2: Loopifying Tail-Recursive Functions1 people · 51 points · first shared 2024 · 7 comments on HN
- 12New Ocaml Cheat Sheets from OcamlPro1 people · 28 points · first shared 2011 · 1 comments on HN
- 13Reduced Memory Allocations with ocp-memprof1 people · 9 points · first shared 2015 · discussion on HN
- 14Let's Encrypt Wildcard Certificates Made Easy with Agnos1 people · 8 points · first shared 2022 · discussion on HN
- 15OCamlPro Highlights: May-June 20141 people · 5 points · first shared 2014 · discussion on HN
What HN people wrote when they linked it
frou_dh · 2019-09-22
Love a good cheatsheet that actually respects the concept of being a SINGLE, fixed-layout page: http://www.ocamlpro.com/wp-content/uploads/2019/09/ocaml-lang.pdf
It's something of a lost art in the paperless and HTML era of documentation.
beckford · 2024-08-24
> The goal is that we can play Sudoku in TypeScript while the type checker complains about mistakes. This is not about implementing a Sudoku solver.
That goal could be extended to implement a Sudoku solver in the type system. One such solver was described at https://ocamlpro.com/blog/2017_04_01_ezsudoku/ for OCaml. TLDR: Your compiler can report the solution as an error message if your language supports refutation and has enough type machinery to accurately model Sudoku.
Having said that, I don’t think a Sudoku solver implementation embedded in a type system is practical (maybe fun for educational purposes though!)
mega_dean · 2023-10-20
Here's a similar article that I read recently about using Ocaml's type system to implement a sudoku solver: https://ocamlpro.com/blog/2017_04_01_ezsudoku/ The author defines types to represent a valid sudoku board, and then uses the obscure syntax `-> .` to tell the compiler that a pattern should be unreachable.
There is no compiler error when he compiles an unsolvable input. But when there is a solution, the compiler provides it:
```
Error: This match case could not be refuted.
Here is an example of a value that would reach it:
Grid (A, B, C, D, C, D, A, B, B, A, D, C, D, C, B, A)
```
xvilka · 2023-08-27
See also a post about OCamlPro experience on migrating some COBOL projects to use GnuCOBOL[1].
[1] https://ocamlpro.com/blog/2023_03_18_autofonce/
Akkuma · 2016-03-16
Flow is being ported to work on windows and there are now builds out there for it https://github.com/OCamlPro/flow & the binary downloads http://www.ocamlpro.com/pub/ocpwin/flow-builds/
lpw25 · 2014-06-11
Indeed using the improved OCaml inliner (http://www.ocamlpro.com/blog/2013/07/11/inlining-progress-report.html) on the original OCaml gives a speedup of 2.75.
yawaramin · 2020-06-13
> I don’t think you understand how F# implements units of measure. It’s not just another data type, they’re fully inferred and checked and work with generics
Yes, units of measure are really cool, and I understand they support dimensional analysis out of the box. It's quite unique, and I fully agree that abstract types don't fully replace them. Just saying that that's what people do in OCaml.
> I don’t think anyone would say Haskell does multicore the “wrong” way
And it certainly is not something that I said.
> OCaml as you say has had decades to solve these problems.
The 'problems' being the lack of multicore support? As I said, this is not really stopping people from getting real work done in industry–see everyone using OCaml currently in highly concurrent and multi-process parallelized applications, or in fact even people using NodeJS, Python, Ruby.
> the community is very small
Correct, but it is definitely growing.
> and the language evolution has been extremely conservative for the most part.
Not so correct. There have been massive amounts of changes in the last few years: https://www.ocamlpro.com/2019/09/20/a-look-back-on-ocaml/
And this is not even taking into account the features which OCaml had before then beyond F#:
- Polymorphic variant types
- Structural subtyped object types
- Named arguments
- Optional arguments
- Functors
tom_mellior · 2018-02-16
Not saying it's the closest to what you have in mind, but you could look at the Emacs Tuareg mode for OCaml. Here is a reference card: http://www.ocamlpro.com/files/tuareg-mode.pdf
If you are a SLIME fan, you might notice that some of the key bindings to interact with the toplevel (the OCaml word for "REPL") are identical in Tuareg.
That said, although this will sound tongue-in-cheek: Having used Isabelle and Coq with their interactive editors, I find their approach better than a REPL. In these systems, you execute code directly from your source file, as opposed to (conceptually) sending snippets of code to a REPL. There is no concept of code you have written in the source (or the REPL) which is not synced up with the state of the REPL (or the source code, respectively). I wish other languages had modes like this. There seems to be one for Prolog, but I've never used it and don't know how well it works in practice: https://www.metalevel.at/ediprolog/
jallmann · 2014-08-03
#5 of Build Tools and Runtime would cover that (encapsulating all global state into a runtime context). The ongoing multicore work at OCamlPro is taking this approach [1].
Erlang-style actors or lightweight processes would be my dream multicore scenario (no more monads for concurrent IO!), but that's likely too difficult to graft onto the current runtime, which is otherwise extremely well-done.
Also, I'd really like checked exceptions. The omission of checked exceptions has always struck me as strange, given the emphasis on compile-time checking. Considering how fast exceptions are in OCaml, it seems like a bit of a missed opportunity -- it is faster to use exceptions for control flow [2] than matching on variants (such as Option), which usually involve an extra allocation + dereference, IIRC.
[1] http://www.ocamlpro.com/pub/multi-runtime.pdf.tar.gz
[2] Odd as it may sound, it's encouraged to use exceptions as a control-flow construct in OCaml, but that is falling out of favor in modern code as far as I can tell.
progman · 2019-03-29
Companies using OCaml: https://ocaml.org/learn/companies.html
What is OCaml used for? https://www.quora.com/What-is-OCaml-used-for?share=1
Further infos:
awesome-ocaml - A curated collection of awesome OCaml tools, frameworks, libraries and articles: https://github.com/ocaml-community/awesome-ocaml
OCamlPro Research and Development: https://www.ocamlpro.com/research-and-development/
OCaml Weekly News (RSS): http://alan.petitepomme.net/cwn/cwn.rss