ekmett / profunctors

Haskell 98 Profunctors
http://hackage.haskell.org/package/profunctors
Other
70 stars 43 forks source link

Strong Categories are Applicative #89

Closed wygulmage closed 3 years ago

wygulmage commented 4 years ago

For example, the Applicative instance of Tambara could be

instance (Category p, Profunctor p) => Applicative (Tambara p a) where
  pure x = lmap (const x) id
  pf <*> px = uncurry' pf . strong (,) px
  liftA2 f px py = strong (f . snd) (lmap fst py) . strong (,) px

I don't think there are any Applicative laws that Strong & Category doesn't cover. Would this be an acceptable change? Should I open a PR?