beark / ftl

C++ template library for fans of functional programming
zlib License
992 stars 69 forks source link

monoid defined in_terms_of_plus: are 0 and operator+ the good abstraction? #16

Closed viboes closed 9 years ago

viboes commented 9 years ago

I wonder if 0 and operator+() is the appropriated abstraction. What about an Additive concept that defines zero<M>() -> M and 'add(M, M) -> M'?

beark commented 9 years ago

Well, the point of that deriving mechanism was convenience, so that a user could easily get a monoid instance for a custom type without having to implement anything in addition (assuming their type has the correct operator and identity element as default constructor).

There might indeed be an argument for the abstraction you describe too, but I have no plans to introduce it right now. Perhaps if my interest in this project is sparked anew at some point.

viboes commented 9 years ago

No problem. It was just a suggestion.