PureScript supports record types, which are similar to structs in other languages. We can use them to express a composition of types. Here’s an example demonstrating this concept:
To run this program, you would typically use the PureScript compiler (purs) and Node.js:
In this PureScript version, we’ve translated the concept of struct embedding to record composition. PureScript uses record types and functions to achieve similar behavior to Go’s struct methods. The Describer typeclass is used to mimic the interface behavior from the Go example.