Stephen Weeks

10 posts by Stephen Weeks

Dec 11, 2013 | 1 min read
A module type equivalence surprise
I usually think of two module types S1 and S2 as being equivalent if the following two functors type check:
Mar 22, 2012 | 1 min read
ML workshop
The upcoming ML workshop is September 13th in Copenhagen. The goal is to bring together users and researchers, with users particularly welcome to propose a...
Oct 17, 2011 | 5 min read
+'a and -'a
If you’ve ever wondered what it means in OCaml when there is a + or - in front of a type variable, read on.
Aug 02, 2011 | 8 min read
Using types to track defaults
We use OCaml’s optional arguments a fair bit at Jane Street. One nagging problem has been coming up with a good way of documenting in...
May 14, 2008 | 2 min read
Ensuring that a function is polymorphic
Here’s a little trick that I find useful when I get a type error due to a function that I believe is polymorphic, but isn’t...
Apr 25, 2008 | 2 min read
using with type on a variant type
Here’s a type-checking problem I ran into today. I had a module with a variant type matching a signature that exposed the variant type.
Mar 20, 2008 | 1 min read
Variable-argument functions
Here’s another puzzle:
Mar 14, 2008 | 1 min read
Using let module for matching
In OCaml, referring to constructors defined in other modules can be somewhat awkward. Suppose we have a module like the following.
Mar 11, 2008 | 1 min read
Extracting an exception from a module
The Unix module defines the Unix_error exception constructor.
Mar 07, 2008 | 1 min read
A universal type?
Is it possible in OCaml to implement a universal type, into which any other type can be embedded? More concretely, is possible to implement the...