
These classes seem like they might correspond to concepts in category theory: class Functor f where fmap :: (a -> b) -> f a -> f b -- must satisfy: -- fmap id = id -- fmap (p . q) = (fmap p) . (fmap q) class (Functor f) => C1 f where f1 :: f (a -> b) -> f a -> f b class (C1 f) => C2 f where return :: a -> f a -- must satisfy: -- fmap = f1 . return class (C2 f) => Monad f where (>>=) :: f a -> (a -> f b) -> f b -- must satisfy: -- fmap ab fa = fa >>= (return . ab) -- f1 fab fa = fab >>= (\ab -> fmap ab fa) -- (return a) >>= p = p a -- (fa >>= p) >>= q = fa >>= (\a -> p a >>= q) What are good names for C1, C2 and f1? -- Ashley Yakeley, Seattle WA

On Mon, Feb 07, 2005 at 06:54:50PM -0800, Ashley Yakeley wrote:
These classes seem like they might correspond to concepts in category theory:
class (Functor f) => C1 f where f1 :: f (a -> b) -> f a -> f b
class (C1 f) => C2 f where return :: a -> f a -- must satisfy: -- fmap = f1 . return
fmap+return is often called a premonad. I don't know of a good name for fmap+return+f1. Doaitse Swierstra calls the class Sequence and calls f1 (<*>), Conor McBride calls it Idiom, and I'd call it a weakly symmetric lax monoidal functor or a strong lax monoidal functor. There are more equations, too; see http://www.haskell.org/arrows/arrows/Control.Sequence.html Also Conor's hack: http://www.haskell.org//pipermail/haskell/2004-July/014315.html
participants (2)
-
Ashley Yakeley
-
Ross Paterson