Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
Does it make sense to say a functor is applicative iff it distributes over heterogeneous lists?
type family (f :: a -> b) <$> (xs :: [a]) :: [b]
_ <$>  = 
f <$> (x : xs) = f x : f <$> xs
class Functor f => Applicative' f
distrib :: HList (f <$> xs) -> f (HList xs)
That's just generalization of Monoidal, isn't it?
Well what I'm claiming is that it's neither a generalization nor a specialization, it's exactly equivalent. I'm not sure though. Do you think there's more Applicative's than Monoidal/Applicatives?
"Generalization" as in "it uses more general version of product, not just 2-tuple"
Ah, I see. What I'm hoping is that the 2-tuple + 0-tuple version is nevertheless equivalent.
You can write
distrib' :: Applicative f => HList (f <$> xs) -> f (HList xs)
distrib' = \case
HNil -> pure HNil
x :* xs -> (:*) <$> x <*> distrib' xs
pure' :: Applicative' f => a -> f a
pure' = (\(a :* HNil) -> a) <$> distrib (a :* HNil)
(<*|>) :: Applicative' f => f (a -> b) -> f a -> f b
f <*|> a = (\(f' :* a' :* HNil) -> f' a') <$> distrib (f :* a :* HNil)
so they should be I guess
(haven't typechecked this though)