CRAIGFE/posts
  •    •    •  

Blog posts

Ramblings about OCaml tooling and design patterns.
Generalised signatures( ~ 11 min )
This post presents a technique for defining more reusable OCaml signatures, helping to maintain consistent APIs with minimal boilerplate. We…
Read more
Polymorphic type constraints( ~ 10 min )
In this post, I explain a common mistake when writing constraints of polymorphic functions in OCaml programs, then show how to correct it…
Read more
The _intf trick( ~ 6 min )
In this post, I explain a trick for avoiding duplication of types between .ml and .mli files that will be familiar to anyone who's…
Read more
Tail recursion modulo cons( ~ 3 min )
If the last action of a function is to call another function , the language run-time doesn't need to keep 's stack frame around when…
Read more
Testing manpages( ~ 1 min )
Dune supports a diff action that compares two files and and fails if ≠ . The magic of this action is that it allows the user to…
Read more
Pitfalls of polymorphic ignore( ~ 1 min )
In OCaml, we can ignore the return value of a side-effecting computation by either naming it _ or using Stdlib.ignore . These are…
Read more

© 2020-2022 • Craig Ferguson