witchcrafters / type_class

(Semi-)principled type classes for Elixir
https://hex.pm/packages/type_class
MIT License
140 stars 16 forks source link

HOTFIX: equal?/2 should not assert #18

Closed expede closed 6 years ago

expede commented 6 years ago

Root Issue

Steps to Reproduce

On my machine, this does not occur when compiling Witchcraft with fresh deps and _build. I was able to reproduce with a new application that used Witchcraft as a dependency. This typically fails on Ord.ex prop checks.

Edited deps/type_class/lib/type_class/property.ex, removing the asserts, and everything works. The offending line requires checking two possible options with an or. Since assert will blow up on a single failure, this makes any boolean logic impossible.

Still Need Better Fail Reporting

While the errors generated by assert were more detailed, they were often of little use. For example, this doesn't tell me anything about the values that lead to failure:

Assertion with == failed
code:  assert left == right
left:  :equal
right: :lesser

Better error messages would be very useful. It's not new information that the prop-testing system could be improved, and this should be explored.

History

@SchrodingerZhu reported that Algae was unable to build, failing compile-time prop checks.

Some discussion occurred in that thread. For some reason, I did not receive an email until 5 days later. This isn't the first time this has happened. I will explore my spam filtering and GitHub email settings.