Category Archives: Category Theory

The ‘Subschema’ Relation on JSON Schemas

JSON1 is one of the most popular formats for language-agnostic data communication between software services. This could be synchronous communication as in HTTP REST apis, or asynchronous communication as in Kafka messages. When services communicate we need to ensure that the messages produced by the producer can be understood by the consumer. Within a service, this is the role of static types to check at compile time that all the intra-service communication is structurally valid2; between services, this is the role of the “JSON schema”3. Continue reading

Posted in Category Theory, Computer Science | Leave a comment

Anonymous Algebraic Data Types

In functional programming, there is a nice symmetry between types and values. While we often think of types and values as playing different roles – the types as being the ‘objects’ and the values as being the ‘arrows’ (or the inhabitants of types) in the category of types (Hask) – we can also look at types as ‘values’ themselves, of an object called ‘Type’ (often denoted ‘*’), in a higher level category. Continue reading

Posted in Category Theory, Computer Science, Functional Programming | Leave a comment

Grammar is like a Type System

In an analogy between natural language and programming language, grammar can be compared to a type system, which provides a great way to learn about one if you know about the other1. Continue reading

Posted in Category Theory, Functional Programming, Linguistics | Leave a comment

The Real Numbers

The real numbers are often introduced as an extension of the natural numbers. While this is how they developed historically, and is often how they are formally constructed, it is not possible to seamlessly extend the concept of a natural number into the concept of a real number – they are used for different purposes. Continue reading

Posted in Category Theory, Education, Mathematics, Philosophy | 1 Comment