Proposal: Add Compositor class as superclass of Arrow
conal at conal.net
Wed Oct 17 21:54:34 EDT 2007
While we're at it, how about one or more classes in between
Category/Compositor and Arrow? One example is DeepArrow (see wiki page 
and haddock docs ). 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
On 10/13/07, Ashley Yakeley <ashley at semantic.org> wrote:
> (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 at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries