monoidal-functors icon indicating copy to clipboard operation
monoidal-functors copied to clipboard

Work out newtype and fundep scheme to avoid instance overlaps

Open solomon-b opened this issue 2 years ago • 0 comments

For example:

deriving via FromApplicative (Proxy :: Type -> Type) instance Semigroupal (->) (,) (,) (Proxy :: Type -> Type)
deriving via FromDivisible (Proxy :: Type -> Type) instance Semigroupal (->) (,) (,) (Proxy :: Type -> Type)

deriving via FromAlternative (Proxy :: Type -> Type) instance Semigroupal (->) Either (,) (Proxy :: Type -> Type)
deriving via FromDecidable (Proxy :: Type -> Type) instance Semigroupal (->) Either (,) (Proxy :: Type -> Type)

The instances are indistinguishable because we don't mention the input category in Semigroupal. Unfortunately the reason for this is that the input category doesn't actually occur in the operation of Semigroupal leading to ambiguity which would require tedious type application from our users to resolve. To have are cake and eat it too, we would need to add this input category type parameter to Semigroupal and come up with a system of fundeps so that it would fixed without the use of type applications.

solomon-b avatar Feb 06 '23 07:02 solomon-b