Category Archives: Computer Science

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

Classifying Software Testing

There are so many terms used for different kinds of software testing:

Software Testing Word Wall

There’s a lot of overlap between some of these terms, and some terms such as ‘Integration Testing’ mean different things in different contexts or to different people1. Also, without some kind of mental framework, it can be difficult to understand how all these kinds of testing relate to each other and fit together, and without that understanding, how can we know for sure we’ve covered all conceivable kinds of software testing?

The aim of this post is to create a framework which can help with these things2. Continue reading

Posted in Computer Science | Leave a comment

Infix Order Reversal

In Haskell, given any function with two arguments (curried) we can choose to use it infix position. The syntax for this depends on how we name the function; if we name the function in the form (s) then s is the infix form of the function, and otherwise an arbitrary function f can be converted to infix form by wrapping in backticks, as in `f`.

In either case, the infix form of the function expects the arguments in a certain order, and the order used in Haskell is:

(s) x y := x s y

I think it would be more natural if the order was the other way around, so:

(s) x y := y s x Continue reading

Posted in Computer Science, Functional Programming, Linguistics | 3 Comments

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