If there would be a package where this could be in it would be contravariant[1], but it isn't.
> > newtype Q' p f a = Q' (p a -> f a) This compiles: > instance (Contravariant p, Functor m, MonadFix m) => Applicative (Q' p m) > where > pure a = Q' (pure (return a)) > Q' fs <*> Q' as = Q' $ \r -> do > rec > f <- fs (contramap ($ a) r) > a <- as (contramap (f $) r) > return $ f a [1] http://hackage.haskell.org/package/contravariant -- Sjoerd Visscher https://github.com/sjoerdvisscher/blog _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
