Skip to content

Instantly share code, notes, and snippets.

@rossabaker
Last active September 7, 2025 04:35
Show Gist options
  • Select an option

  • Save rossabaker/2f50e77cecc6afd096dd7895f763b5f6 to your computer and use it in GitHub Desktop.

Select an option

Save rossabaker/2f50e77cecc6afd096dd7895f763b5f6 to your computer and use it in GitHub Desktop.
migrated to paste.rossabaker.com
@rossabaker
Copy link
Author

I don't know about "tricky". CIString satisfies the contract of .equals. There's no substitution law. cats.Eq doesn't have one either. Haskell's Eq recently added it as an "expectation", but officially has no laws. We should strongly prefer that property, but it's neither illegal nor unusual to break it. A couple more examples:

  • (s: Set[A] => s.toList) (ordering is undefined)
  • (d: Double) => 1.0 / d (try it with 0.0 and -0.0)

A set whose equivalence relation guarantees substitution is a functor, but Scala's Set doesn't, so it's not.

@philipschwarz
Copy link

Noted. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment