bifunctors icon indicating copy to clipboard operation
bifunctors copied to clipboard

Applicative Tannen

Open Icelandjack opened this issue 4 years ago • 0 comments

I forgot if I've brought this up before, should this instance exist?

instance (Applicative f, Biapplicative bi, Monoid a) => Applicative (Tannen f bi a) where
 pure :: b -> Tannen f bi a b
 pure b = Tannen do
  pure (bipure mempty b)

 liftA2 :: (b1 -> b2 -> b3) -> (Tannen f bi a b1 -> Tannen f bi a b2 -> Tannen f bi a b3)
 liftA2 (·) (Tannen as) (Tannen bs) = Tannen do
  liftA2 (biliftA2 (<>) (·)) as bs

Icelandjack avatar Sep 14 '20 00:09 Icelandjack