Proposal: Add Semigroup and Monoid instances for (:~:)

Ryan Scott ryan.gl.scott at gmail.com
Mon Jan 18 00:02:42 UTC 2016


+1, with a one stipulation: I'd rather the Semigroup instance be:

    instance Semigroup (a :~: b) where
      Refl <> Refl = Refl

and similarly for Monoid(mappend). It's a minor quibble, but the
documentation [1] for (:~:) says that there's only a proof term for a
~ b if it's inhabited by a terminating value, so performing a strict
pattern match seems like the best default here.

Ryan S.
-----
[1] http://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Type-Equality.html#t::-126-:


More information about the Libraries mailing list