
It sounds like Coyoneda -- i.e. Mapped with the "a" existential --
might be what you're looking for:
http://hackage.haskell.org/package/kan-extensions-4.2.3/docs/Data-Functor-Co...
Shachaf
On Sun, Jan 3, 2016 at 5:11 PM, Henning Thielemann
On Mon, 4 Jan 2016, Oliver Charles wrote:
Could you provide some examples where you have found it useful?
E.g. Set has Foldable instance, but not Functor. Using Mapped I can implement argmax in a generic way, such that it also works on Set.
argmax :: (Ord b, Foldable f) => (a -> b) -> f a -> a argmax f = snd . Fold.maximumBy (comparing fst) . Mapped (\a -> (f a, a))
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries