sseefried/shady-graphics — comment on commit fc12faff3d1acb31fcef1a4d9316ab0d6ed34e50
File:  line 0
By conal:

Hi Sean.

The type class morphism (TCM) principle, in which I've come to have a lot of trust, suggests to me that a type have the same instances as its semantics and that the semantic function is a morphism with respect to those classes. Since the semantics of `Exp t` is `t`, I'd expect that `Exp t` is a monoid exactly when `t` is, which implies that `Monoid (Exp Any)`, and `Monoid (Exp All)`, but not `Monoid (Exp Bool)`. Similarly for numeric types with `Sum` and `Product`.

Even you don't have my faith in TCM (and, of course, I didn't at first), you might consider all the reasons for *not* wanting `Bool` to be in `Monoid` in Haskell, or at least not the `Any` monoid (as I understand you to have chosen). My guess is that all of those reasons are equally compelling for `Exp Bool`. Keep in mind that Shady is a general purpose language, not a domain-specific one.

As usual, I'm happy to discuss. Doing so would slow hacking progress but improve our ability to collaborate effectively.

BTW, did you add a `Monoid` instance for `Exp Bool` (`BoolE`) somewhere, either in shady-gen or as an orphan in shady-graphics? Though I haven't seen such an instance, I figure you'd have to add it for your modified `HasColor BoolE` instance to type-check.