map and fmap

Ashley Yakeley ashley at semantic.org
Wed Aug 30 22:15:08 EDT 2006


Cale Gibbard wrote:
> Indeed, I agree.

While we're at it, I'd like to see the Arrow class a bit more thinly 
sliced. Something like this:

   class Compositor a where
     identity :: a b b
     (>>>) :: a b c -> a c d -> a b d

   class Compositor a => Arrow a where
     pure :: (b -> c) -> a b c

   class Arrow a => ArrowProduct a where
     (&&&) :: a b c -> a b c' -> a b (c, c')
     -- derived:
     first :: a b c -> a (b, d) (c, d)
     second :: a b c -> a (d, b) (d, c)
     (***) :: a b c -> a b' c' -> a (b, b') (c, c')

   class Arrow a => ArrowCoproduct a where
     (|||) :: a b d -> a c d -> a (Either b c) d
     -- derived:
     left :: a b c -> a (Either b d) (Either c d)
     right :: a b c -> a (Either d b) (Either d c)
     (+++) :: a b c -> a b' c' -> a (Either b b') (Either c c')

   class (ArrowProduct a,ArrowCoproduct a) => ArrowFull a

   etc.

-- 
Ashley Yakeley
Seattle WA



More information about the Haskell-prime mailing list