[Haskell-cafe] Product Profunctor and Contravariant

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sun Sep 29 11:44:15 CEST 2013


Does anyone recognise these typeclasses:

    import Data.Profunctor (Profunctor)
    import Data.Functor.Contravariant (Contravariant)
    
    class Profunctor p => ProductProfunctor p where
      empty :: p () ()
      (***!) :: p a b -> p a' b' -> p (a, a') (b, b')

    class Contravariant f => ProductContravariant f where
      point :: f ()
      (***<) :: f a -> f b -> f (a, b)

They are both a bit like Applicative, and ProductProfunctor is basically
Arrow without the Category part.  I'm finding ProductProfunctor useful for
marshalling data from a database into Haskell, and both of them come up a
lot inside my database library.

Has anyone ever seen these before?  Has Edward Kmett written a library for
these already?  Thanks,

Tom



More information about the Haskell-Cafe mailing list