Good name for this operator?

Hi all! When working with Applicative, I often find myself defining and using this operator: (<%>) :: (Applicative f) => f (a -> b) -> a -> f b f <%> x = f <*> pure x and always keep wondering whether it is already known by another name. Can't find it in Control.Applicative. Hoogle didn't give me much either. NB: In general, there's a weird obstacle I notice when writing Haskell: the unshakable feeling that whatever I write, there's already a better name for it and a more elegant implementation lying around. It can get downright paralyzing at times *shudder* Have Fun, -- Ariel J. Birnbaum

On Sat, Nov 15, 2008 at 3:59 PM, Ariel J. Birnbaum
Hi all!
When working with Applicative, I often find myself defining and using this operator:
(<%>) :: (Applicative f) => f (a -> b) -> a -> f b f <%> x = f <*> pure x
Yeah, me too. The syntax chosen for applicative does not encode all the information about the lifting of each side. For example, as far as I can tell, <$> is appropriate for both this and for fmap. So I think <%> is a fine name (I often use % as the application operator when I'm encoding lambda calculus). Luke

On Sat, 2008-11-15 at 16:23 -0700, Luke Palmer wrote:
On Sat, Nov 15, 2008 at 3:59 PM, Ariel J. Birnbaum
wrote: When working with Applicative, I often find myself defining and using this operator:
(<%>) :: (Applicative f) => f (a -> b) -> a -> f b f <%> x = f <*> pure x
Yeah, me too.
So how does one go about asking for its inclusion in Control.Applicative? We might as well agree on a common name for it... -- Ariel J. Birnbaum

On Sun, Nov 16, 2008 at 12:59:09AM +0200, Ariel J. Birnbaum wrote:
When working with Applicative, I often find myself defining and using this operator:
(<%>) :: (Applicative f) => f (a -> b) -> a -> f b f <%> x = f <*> pure x
and always keep wondering whether it is already known by another name.
f <%> x = fmap ($ x) f will be more efficient in many cases. As for the name, <$$> would be analogous with the existing <**>.
participants (3)
-
Ariel J. Birnbaum
-
Luke Palmer
-
Ross Paterson