int-index / union

Extensible type-safe unions for Haskell
BSD 3-Clause "New" or "Revised" License
32 stars 2 forks source link

Accidentally wrote the same library #3

Open andrewthad opened 8 years ago

andrewthad commented 8 years ago

This isn't really an issue, but @mckeankylej just pointed out to me that we inadvertently wrote the same library. In particular, your Union is identical to my CoRec and your lens machinery is identical to my optics. (The typeclass in that module should actually redefine rput, rget, etc. as well, but it looks like I got lazy and forgot to add those).

int-index commented 8 years ago

The typeclass in that module should actually redefine rput, rget, etc. as well

That's a useful insight, thanks. I thought about unifying RElem and UElem, but my initial ideas were more complex than just smashing all methods together.

your lens machinery is identical to my optics

Well, similar, but not identical. You define ccast :: CoRec f sub -> CoRec f super whereas I define usubset :: Prism' (Union f bs) (Union f as), which is strictly more powerful. vinyl also defines rsubset as a lens, not a simple projection.

andrewthad commented 8 years ago

Ah, I didn't realize there was a prism for corecord subset. Thanks for pointing that out.