ekmett / profunctors

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

Maybe useful, Closed returning (pro (f b) (f b')) for some Applicative f #60

Open Icelandjack opened 6 years ago

Icelandjack commented 6 years ago

There is a Closed instance for newtype Ignore a b = Ignore b

instance Closed Ignore where
  closed :: forall xx b b'. Ignore b b' -> Ignore (xx -> b) (xx -> b')
  closed (Ignore b') = Ignore (pure @(xx ->) b')

but hm, pure works for any Applicative ("Pointed"). So maybe this is useful

class Profunctor pro => Closed' pro where
  closed' :: Applicative f => pro b b' -> pro (f b) (f b')
ekmett commented 3 years ago

I'm much more inclined to allow this to work for an arbitrary distributive/representable where it is actually fully sound.

ekmett commented 3 years ago

Still chewing on this one. Side note: Ignore = Tagged.