Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Is there a way to prove this class can't be implemented:

class Profunctor p => Comux p where comux :: p (a, b) (c, d) -> (p a c, p b d)

@Asad Saeeduddin I guess there isn't:

newtype ConstId a b = ConstId b deriving Show instance Profunctor ConstId where dimap _ f (ConstId c) = ConstId $ f c instance Comux ConstId where comux (ConstId (c, d)) = (ConstId c, ConstId d)

Good thinking! I suppose that means it works for data Joker f a b = Joker (f b) as well

data Joker f a b = Joker (f b)

when f is Alternative, is Joker f a Category?

f

Alternative

Joker f

Category

Hmm, the left-most morphism will always have to win, so I guess it would be lawful?

I think it can be a semigroupoid but not a category

For the same reason data Const a b = a can't be a monoid

data Const a b = a

Why Const isn't monoid?

Const

well, the semigroup works like this: x <> _ = x

x <> _ = x

What if I used Monoid a constraint instead?

Monoid a

basically like Identity instance

Identity

yes, it would work then. unfortunately we can't pull the same trick for Category, because it needs to be parametric in a and b

a

b

Ah, I see

Is there a way to prove this class can't be implemented:

@Asad Saeeduddin I guess there isn't:

Good thinking! I suppose that means it works for

`data Joker f a b = Joker (f b)`

as wellwhen

`f`

is`Alternative`

, is`Joker f`

a`Category`

?Hmm, the left-most morphism will always have to win, so I guess it would be lawful?

I think it can be a semigroupoid but not a category

For the same reason

`data Const a b = a`

can't be a monoidWhy

`Const`

isn't monoid?well, the semigroup works like this:

`x <> _ = x`

What if I used

`Monoid a`

constraint instead?basically like

`Identity`

instanceyes, it would work then. unfortunately we can't pull the same trick for

`Category`

, because it needs to be parametric in`a`

and`b`

Ah, I see