Skip to content

Code Style Guide

Cyrus Omar edited this page Sep 4, 2019 · 14 revisions

Warnings

  • Don't leave any warnings. If necessary, you can suppress a warning by putting the [@warning "-#"] annotation narrowly on the node generating the warning, where # is the warning code.

Type Definitions

  • Each type should have its own module, even if it is small.
  • Whenever possible, place [@deriving sexp] on type definitions, which will automatically derive sexp serializers. This will generally require an open Sexplib.Std at the top of your module to open the standard sexp serializers for base types like string and int.
  • List the preferred variable name prefixes with a comment of the form /* Variable: <preferred> */ before the type definition.

Modules

  • Each module should have a corresponding signature (.rei) file if there are any top-level local definitions.
  • Local definitions should be fully type annotated.
Clone this wiki locally