Class invariant contracts? #953
macrologist
started this conversation in
Ideas and Proposals
Replies: 1 comment 2 replies
-
Or, even just some access to compilation in the form of "compilation hooks" that could be installed to test those kinds of invariants in a more ad-hoc fashion. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Typeclasses are sometimes defined with implicit assumptions about invariants that methods of those classes must satisfy for every class instance. E.g. monad laws, ordering laws, etc.
Could coalton support an extension that allows for the expression of these "invariance contracts" at the typeclass definition site, contracts which would be checked post-compile for each instance, signalling some kind of "instance invariant violation errror"?
Beta Was this translation helpful? Give feedback.
All reactions