profunctors 5.1 → 5.1.1
raw patch · 4 files changed
+22/−4 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.markdown +4/−0
- profunctors.cabal +1/−1
- src/Data/Profunctor/Tambara.hs +16/−2
- src/Data/Profunctor/Unsafe.hs +1/−1
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+5.1.1+-----+* Add proper support for GHC 7.0+.+ 5.1 --- * `instance Costrong (Cokleisli f)`.
profunctors.cabal view
@@ -1,6 +1,6 @@ name: profunctors category: Control, Categories-version: 5.1+version: 5.1.1 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE
src/Data/Profunctor/Tambara.hs view
@@ -51,7 +51,10 @@ instance ProfunctorComonad Tambara where proextract (Tambara p) = dimap (\a -> (a,())) fst p produplicate (Tambara p) = Tambara (Tambara $ dimap hither yon p) where+ hither :: ((a, b), c) -> (a, (b, c)) hither ~(~(x,y),z) = (x,(y,z))++ yon :: (a, (b, c)) -> ((a, b), c) yon ~(x,~(y,z)) = ((x,y),z) instance Profunctor p => Strong (Tambara p) where@@ -60,8 +63,11 @@ instance Choice p => Choice (Tambara p) where left' (Tambara f) = Tambara $ dimap hither yon $ left' f where+ hither :: (Either a b, c) -> Either (a, c) (b, c) hither (Left y, s) = Left (y, s) hither (Right z, s) = Right (z, s)++ yon :: Either (a, c) (b, c) -> (Either a b, c) yon (Left (y, s)) = (Left y, s) yon (Right (z, s)) = (Right z, s) @@ -72,12 +78,16 @@ instance Arrow p => Arrow (Tambara p) where arr f = Tambara $ arr $ first f first (Tambara f) = Tambara (arr go . first f . arr go) where+ go :: ((a, b), c) -> ((a, c), b) go ~(~(x,y),z) = ((x,z),y) instance ArrowChoice p => ArrowChoice (Tambara p) where left (Tambara f) = Tambara (arr yon . left f . arr hither) where+ hither :: (Either a b, c) -> Either (a, c) (b, c) hither (Left y, s) = Left (y, s) hither (Right z, s) = Right (z, s)++ yon :: Either (a, c) (b, c) -> (Either a b, c) yon (Left (y, s)) = (Left y, s) yon (Right (z, s)) = (Right z, s) @@ -86,6 +96,7 @@ instance ArrowLoop p => ArrowLoop (Tambara p) where loop (Tambara f) = Tambara (loop (arr go . f . arr go)) where+ go :: ((a, b), c) -> ((a, c), b) go ~(~(x,y),z) = ((x,z),y) instance ArrowZero p => ArrowZero (Tambara p) where@@ -148,9 +159,9 @@ projoin (Pastro l (Pastro m n o) p) = Pastro lm n op where op a = case p a of (b, f) -> case o b of- (c, g) -> (c, (f, g)) + (c, g) -> (c, (f, g)) lm (d, (f, g)) = l (m (d, g), f)- + instance ProfunctorAdjunction Pastro Tambara where counit (Pastro g (Tambara p) f) = dimap f g p unit p = Tambara (Pastro id p id)@@ -168,9 +179,12 @@ instance ProfunctorComonad Cotambara where proextract (Cotambara p) = dimap Left (\(Left a) -> a) p produplicate (Cotambara p) = Cotambara (Cotambara $ dimap hither yon p) where+ hither :: Either (Either a b) c -> Either a (Either b c) hither (Left (Left x)) = Left x hither (Left (Right y)) = Right (Left y) hither (Right z) = Right (Right z)++ yon :: Either a (Either b c) -> Either (Either a b) c yon (Left x) = Left (Left x) yon (Right (Left y)) = Left (Right y) yon (Right (Right z)) = Right z
src/Data/Profunctor/Unsafe.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE Trustworthy #-}-#else+#elif __GLASGOW_HASKELL >= 704 {-# LANGUAGE Unsafe #-} #endif {-# LANGUAGE ScopedTypeVariables #-}