# Cinaps: A Lightweight Approach to Generating Repetitive OCaml Code

DevFeed: [Cinaps: A Lightweight Approach to Generating Repetitive OCaml Code](<https://devfeed.tech/articles/trivial-meta-programming-with-cinaps-20217.md>)

Original publisher: [Read original article](<https://blog.janestreet.com/trivial-meta-programming-with-cinaps/>)

Author: Jeremie Dimino

Published: 2017-03-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jane Street](<https://devfeed.tech/sources/jane-street.md>)

Topics: [OCaml](<https://devfeed.tech/topics/ocaml.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [Library](<https://devfeed.tech/topics/library.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [abstraction](<https://devfeed.tech/tags/abstraction.md>), [code](<https://devfeed.tech/tags/code.md>), [library](<https://devfeed.tech/tags/library.md>), [modules](<https://devfeed.tech/tags/modules.md>), [ocaml](<https://devfeed.tech/tags/ocaml.md>), [programming](<https://devfeed.tech/tags/programming.md>), [source](<https://devfeed.tech/tags/source.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

The article explains how Cinaps helps manage small, repetitive code patterns in OCaml without the review and readability costs of larger code generators or macro preprocessors. It describes Cinaps as an application that runs embedded OCaml code and compares its output with the following source, similar to expectation tests.

## Source excerpt

From now and then, I found myself having to write some mechanical and repetitive code. The usual solution for this is to write a code generator; for instance in the form of a ppx rewriter in the case of OCaml code. This however comes with a cost: code generators are harder to review than plain code and it is a new syntax to learn for other developers. So when the repetitive pattern is local to a specific library or not widely used, it is often not worth the effort. Especially if the code in question is meant to be reviewed and maintained by several people.