The naming of TConstructor is a bit of a stretch. It both names a type constructor and applies it to zero or more type parameters. A more traditional encoding would be:

With this, Array<Int> would be encoded as TApply(TConstructor("Array"), TConstructor("Int")).

However, with the <> syntax for generics that’s traditional in mainstream languages, it becomes a bit awkward when you have a type like Map<Int, String> and you need to encode that as TApply(TApply(TConstructor("Map"), TConstructor("Int")), TConstructor("Int")). That would more naturally map back to Map<Int><String> — but type constructors are not usually curried in mainstream languages. They are in Haskell, though!

One downside of the representation chosen in the article is that it doesn’t extend naturally to higher kinded types — that is, where type variables may stand for type constructors that aren’t fully applied.

--

--

--

MSc Computer Science, working with functional programming in the industry — github.com/ahnfelt

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joakim Ahnfelt-Rønne

Joakim Ahnfelt-Rønne

MSc Computer Science, working with functional programming in the industry — github.com/ahnfelt

More from Medium

If I were a Bird

Constructors

Finding meaning in Grief and Loss