Hi Everyone,

I’m trying to write some code for doing abstract algebra. I know how I would write the code in an object-oriented language (I have some of it written in Typescript), but I don’t know what the equivalent would be in ReScript. For example, I am trying to have some kind of ‘Group’ structure with functions for acting on elements of a particular type. All that is required is an `identity`

element and `multiply`

and `inverse`

functions, and the rest can be defined from that. An example might look as follows:

```
module type Group = {
type el
let identity: el
let multiply: (el, el) => el
let inverse: (el) => el
let isEqual: (el, el) => bool
}
module MakeGroup = (Group: Group) => {
include Group
let divide = (a, b) => multiply(a, inverse(b))
let isIdentity = (e: el) => isEqual(e, identity)
}
module AdditiveIntGroup = {
include MakeGroup({
type el = int
let identity = 0
let multiply = (a, b) => a + b
let inverse = e => -e
let isEqual = (a, b) => a == b
})
let divide = (a, b) => a-b
}
```

This seems like it would work, but is this idiomatic? It doesn’t seem to provide the best compiled Javascript code (a lot of essentially duplicated object definitions). Is there a different way I should be thinking about this?