Do type providers exist in other languages except F#?

As far as I know, the only other language that directly implements type providers is Idris. See the Idris documentation on type providers. There are some examples, including SQL type provider in David Christiansen's GitHub repo. As a dependently typed language, type providers have quite a different look than in F# - they are basically computations in the IO monad that are invoked using the %provide command - so they are a bit more uniform with the rest of the language compared to the F# design.

There are other language features that are related to type providers.

  • This includes various templating systems (such as Template Haskell and camplp4 for OCaml). These lack some of the type provider features (they actually generate code, so you cannot provide "infinite size" types and they are not as integrated with the tooling).

  • There are lots of code generation tools for languages such as Java and C# (LINQ to SQL uses code generation and various UI frameworks do too), but again, this lacks the language integration and can only support types that are relatively small.

  • Another relevant thing is meta-programming such as multi-stage programming, but as far as I can say, this is mostly just academic and there is no solid language implementing this.

It is difficult to say which of these are close to type providers. For me, the essential feature of type providers is the quick feedback I get as a developer when using them (and for some, this means updating schema on the fly during development) - and that's something that code generation tools generally do not do. The other - being able to provide infinite number of types lazily is useful for some type providers, but not for all - so e.g. JSON, XML or CSV could be reasonably handled by a code generation tool.


Java has something nearly identical to type providers via the new project, Manifold.

Instead of Type Provider, Manifold calls it Type Manifold. Although Manifold provides Java with several other features, the Type Manifold API is the foundation upon which all the others are built. Similar to F#, with Manifold Java has type-safe access to virtually any kind of structured data from SQL to CSV to JSON to Javascript... provided there is a Type Manifold implemented. IntelliJ IDEA provides comprehensive support for Manifold via the Manifold Plugin.

Cheers.