Hi folks, I have a small doubt. If I create a Mon...
# arrow
l
Hi folks, I have a small doubt. If I create a Monoid, like this:
Copy code
@instance(Bill::class)
interface BillMonoid : Monoid<Bill> {

    override fun empty(): Bill = Bill(0.0, LocalDate.MIN)

    override fun Bill.combine(b: Bill): Bill = Bill(this.amount + b.amount, this.dueDate)
}
I get the extension function:
Copy code
fun  domain.Bill.Companion.monoid(): BillMonoid =
    object : BillMonoid {

    }
Well, the first problem is: If I don't create a companion object for
Bill
, my code doesn't compile. That's easy to workaround, but is it the expected behaviour? Second: The name of the method I get is
monoid()
. What if I would like to create more than one type of monoid for different types of morphisms? Like one for sums, another one for multiplication, another subtractions... It would be good to be able to control the names that are generated, WDYT?