Library dilemma / Cofunctor class

Conal Elliott conal at
Sat Jan 13 15:09:39 EST 2007

I have a dilemma about library building that I'm expect comes up for other
people as well.

I'm working on a library that includes a Cofunctor instance.  I'd love to
import whatever standard module has the Cofunctor class, and maybe use some
Cofunctor combinators.  But, alas, I haven't found such a thing, and I'm
wondering what to do.  If I keep my Cofunctor class in my own library, the
generality does no good to me or anyone else.  I certainly wouldn't expect
someone to install my library just to get Cofunctor.  Just as I wouldn't
want a dependency on some other mostly-irrelevant library just to get

Another option is for me to make a tiny Cofunctor package with just a single
class declaration, and make my library dependent on it.  I guess that's the
cleanest way and is what I'm leaning toward.  And maybe it could grow into a
more useful Cofunctor library with the addition of functions on generic
Cofunctor types.  Does anyone have useful functionality to go into a
Cofunctor module (beyond the class declaration)?

Comments, advice, brainstorming most welcome.

  Cheers,  - Conal
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Libraries mailing list