adjunctions
adjunctions copied to clipboard
Define 'Representable (Join f)' once we have Bicomonad
For future reference, once we have Bicomonad
class Bifunctor bi => Bicomonad bi where
fst :: bi a b -> a
snd :: bi a b -> b
bidup :: bi a b -> (bi a b `bi` bi a b)
I think we can define a Representable
instance for (Join f)
instance (Biapplicative f, Bicomonad f) => Representable (Join f) where
type Rep (Join f) = Bool
index :: Join f a -> (Bool -> a)
index (Join faa) = \case
False -> fst faa
True -> snd faa
tabulate :: (Bool -> a) -> Join f a
tabulate gen = Join (False `bipure` True)
unless it's unlawful. It captures the pattern of Representable Pair
for newtype Pair a = Pair (a, a)
.
Or some hypothetical Bipointed
, Bicopointed
.