Skip to content

Typeclasses that ONLY define laws. #334

Description

@woparry

What do people think of adding typeclasses that only add new laws (ie. have no new functionality, but restrict which implementations are valid.)

I'm specifically thinking of something like CommutativeMonad, which would add a commutativity restriction to Monad (so that e.g. a distributive law can be derived which would allow composition, see #332 and the related discussion re: Traverse).

Since we have discipline, the extra laws can be checked by implementers fairly easily, and it opens up new avenues for writing slightly more general combinators in cats.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions