lambda icon indicating copy to clipboard operation
lambda copied to clipboard

Coproducts are defined inductively

Open jnape opened this issue 4 years ago • 3 comments

jnape avatar Oct 30 '20 16:10 jnape

Would this be like Purescript's Coproduct.Nested: https://github.com/purescript/purescript-functors/tree/master/src/Data/Functor/Coproduct?

(In that case, would it be useful to add something like Coproduct.Inject and a Project to the higher-order function wishlist?)

nomicflux avatar Nov 02 '20 15:11 nomicflux

The similarities to me seem to end with the idea that they'd both be inductively defined. I have extreme contempt for Const Void in any type signature, and the utility of either an inductive or terminal data constructor of CP1 is a dubious proposition for me, at best. I'm also not a huge fan of the set differentiation falling to higher kind and some perverse contortions like type CP2 a b = Coproduct (Const a) Identity b in order to satisfy the functor itch while also providing the ability to yield an a or a b.

jnape avatar Nov 02 '20 18:11 jnape

I don't implicitly find either Inject or Project to be hateful concepts, so I'm certainly open to them.

jnape avatar Nov 02 '20 18:11 jnape