On Thu, Jul 08, 2004 at 08:36:57PM -0400, David Menendez wrote:
Conor T McBride writes:
infixl 9 <%> -- my name for <# -- others have other names class Idiom i where idi :: x -> i x (<%>) :: i (s -> t) -> i s -> i t
I call them idioms because it's like having the apparatus of applicative programming, just in a different (perhaps impure) idiom.
[I only just found out that they show up under the name Sequence in the experimental Control.Sequence module. I should have known. It's part of the Arrow stuff, and these things are an interesting species of Arrow. As far as I know, it was Ross Paterson who identified them in the categorical jungle as weakly symmetric lax monoidal functors.]
I've also seen this referred to as a pointed functor[1] and a premonad[2]. [...] class Functor f where fmap :: (a -> b) -> f a -> f b
class Functor p => Premonad p where return :: a -> p a
Not quite: premonads let you lift values (using return) and unary functions (using fmap), but the things Conor is talking about let you lift functions of any arity. A premonad doesn't give you lift2 :: (a -> b -> b) -> f a -> f b -> f c