
In article <20030107180142.GA8071@soi.city.ac.uk>,
Ross Paterson
The arrow notation is closely tied to products.
Perhaps, but it doesn't have to be part of the class. I prefer this, for aesthetic reasons: class Arrow a where arr :: (b -> c) -> a b c (>>>) :: a b c -> a c d -> a b d arrApply :: a b (c -> d) -> a b c -> a b d
From this one can derive:
proj1 (b,d) = b proj2 (b,d) = d product c d = (c,d) arrProduct :: (Arrow a) => a b c -> a b d -> a b (c,d) arrProduct abc abd = arrApply (abc >>> (arr product)) abd -- Hughes' 'first' arrFirst :: (Arrow a) => a b c -> a (b,d) (c,d) arrFirst abc = arrProduct ((arr proj1) >>> abc) (arr proj2) There only needs to be one class, and you can use whatever product you like by using the appropriate functions for 'proj1', 'proj2' and 'product'. <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/hbase/Source/H Base/Category/Arrow.hs?rev=HEAD&content-type=text/plain> -- Ashley Yakeley, Seattle WA