While we're at it, how about one or more classes in between Category/Compositor and Arrow?  One example is DeepArrow (see wiki page [1] and haddock docs [2]).  Sample instances: functions and transformers of typed type representations, UIs, code, and pairs of same.  I've currently structured DeepArrow as a subclass of Arrow, but most of my instances do not have arr.  Any real arrow (including arr) is a DeepArrow (or almost), as the haddock docs mention.

DeepArrow could benefit from suggestions (perhaps refactoring), and I would appreciate such input.  In any case, I imagine there's some rich, useful structure between Category & Arrow, and now would be a great time to explore it before settling on a new class hierarchy.

Cheers,  - Conal

[1] http://haskell.org/haskellwiki/DeepArrow
[2] http://darcs.haskell.org/packages/DeepArrow/doc/html/Control-Arrow-DeepArrow.html


On 10/13/07, Ashley Yakeley < ashley@semantic.org> wrote:
http://hackage.haskell.org/trac/ghc/ticket/1773
(darcs patch attached to ticket)

The Compositor class has two members:

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

with the obvious monoid. Since all Arrows are Compositors, make
Compositor a superclass of Arrow.

A number of useful types are Compositors but not Arrows:

1. Bijections

   data Bijection a b = MkBijection (a -> b) (b -> a)

2. Codecs, i.e. encoder/decoder pairs such as charset converters

   data Codec base derived = MkCodec
   {
     encode :: derived -> base,
     decode :: base -> Maybe derived -- or other Monad
   }

   utf8 :: Codec [Word8] String
   xml :: Codec String XML

3. Lenses
These make updatable sections of data structures.

   data Lens s t = MkLens
   {
     lensGet :: s -> t,
     lensPutback :: t -> s -> s
   }

See http://www.cis.upenn.edu/~bcpierce/papers/lenses-etapsslides.pdf

4. Reified proofs of type identity
   These are useful if you use GADTs and type-witnesses a lot.

   newtype SameType a a' = MkSameType (forall f. f a -> f a')

Proposal period: two weeks, until 10-27

_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries