Permalink
Browse files

Revamping Category.

I've removed Choice because (|||) isn't really appropriate for Lens since one would expect uncurry (|||) :: (Lens a c, Lens b c) -> (Lens (Either a b) c) to be a bijection, notwithstanding what Control.Arrow does.
I've renamed the Control.Category.Split module into Control.Category.Product and renamed the class Split into Tensor.
I've added a class called Product for (&&&) even thought it isn't used in lens.
Hopefully, these categorical modules will be put into their own package one day.
  • Loading branch information...
1 parent 1a09497 commit 8f0158c89290271799d2c4cc1d6fd5193ed3da2a @roconnor committed Mar 31, 2012
View
@@ -1,3 +0,0 @@
-import Distribution.Simple
-main = defaultMain
-
@@ -1,13 +0,0 @@
-module Control.Category.Choice where
-
-import Control.Arrow hiding ((|||))
-
-infixr 2 |||
-class Choice c where
- (|||) :: c x z -> c y z -> c (Either x y) z
-
-instance Choice (->) where
- (|||) = either
-
-instance Choice (Kleisli m) where
- Kleisli f ||| Kleisli g = Kleisli $ either f g
@@ -1,13 +0,0 @@
-module Control.Category.Codiagonal where
-
-import Control.Arrow
-import Control.Applicative
-
-class Codiagonal c where
- codiagonal :: c (Either a a) a
-
-instance Codiagonal (->) where
- codiagonal = either id id
-
-instance Applicative m => Codiagonal (Kleisli m) where
- codiagonal = Kleisli $ either pure pure
File renamed without changes.

1 comment on commit 8f0158c

I agree that (|||) is not bijective and does not correspond to Control.Arrow.(|||), however it is a useful function on lenses. Is it a reasonable compromise to rename the method (such as .|.) and type-class (e.g. keep Choice) and explicitly note is dissimilarity to Control.Arrow (Choice /= FanIn)?

Please sign in to comment.