bifunctors icon indicating copy to clipboard operation
bifunctors copied to clipboard

Add Applicative instance for Biff

Open masaeedu opened this issue 5 years ago • 1 comments

masaeedu avatar Apr 08 '20 16:04 masaeedu

This seems a bit arbitrary to me. Couldn't you write a Data.Functor.Compose-like instance like this?

instance (Applicative (p (f a)), Applicative g) => Applicative (Biff p f g a) where
  pure = Biff . pure . pure
  liftA2 f (Biff xs) (Biff ys) = Biff $ liftA2 (liftA2 f) xs ys

I'm not saying we should do this, but it's not at all obvious that the limited instance you suggest is the right one, if there is a right one.

treeowl avatar Sep 07 '21 22:09 treeowl