Get the latest tech news

Higher-kinded bounded polymorphism in OCaml (2021)


How bounded higher-kinded polymorphism arises in practice, and how to express it in OCaml, in several different ways. Some ways are rather concise -- but less widely known.

Let us now turn to construction: building of values using a fixed set of operations, which can be considered an embedded DSL. On the up side, writing DSL terms cannot be easier: no type annotations, no functors, no implementation passing -- and no overt polymorphism, higher-kind or even the ordinary kind. Hint: the first example in Yallop and White's paper, monad representations, is an example of a DSL embedding in tagless-final style.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ocaml

ocaml

Related news:

News photo

Comparing OCaml and Standard ML (2008)

News photo

Dream-HTML – render HTML, SVG, MathML, Htmx markup from OCaml