algebra 2.0.7 → 2.1
raw patch · 5 files changed
+24/−45 lines, 5 filesdep ~categoriesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: categories
API changes (from Hackage documentation)
- Numeric.Map: instance Comonoidal (Map r) (,)
- Numeric.Map: instance Comonoidal (Map r) Either
- Numeric.Map: instance Disassociative (Map r) (,)
- Numeric.Map: instance Disassociative (Map r) Either
- Numeric.Map: instance PreCartesian (Map r)
- Numeric.Map: instance PreCoCartesian (Map r)
+ Numeric.Map: instance Cartesian (Map r)
+ Numeric.Map: instance CoCartesian (Map r)
Files
- Numeric/Algebra/Quaternion.hs +0/−1
- Numeric/Coalgebra/Quaternion.hs +0/−1
- Numeric/Covector.hs +0/−1
- Numeric/Map.hs +22/−40
- algebra.cabal +2/−2
Numeric/Algebra/Quaternion.hs view
@@ -33,7 +33,6 @@ import Numeric.Algebra.Distinguished.Class import Numeric.Algebra.Complex.Class import Numeric.Algebra.Quaternion.Class-import qualified Numeric.Algebra.Complex as Complex import Prelude hiding ((-),(+),(*),negate,subtract, fromInteger) instance Distinguished QuaternionBasis where
Numeric/Coalgebra/Quaternion.hs view
@@ -33,7 +33,6 @@ import Numeric.Algebra.Distinguished.Class import Numeric.Algebra.Complex.Class import Numeric.Algebra.Quaternion.Class-import qualified Numeric.Algebra.Complex as Complex import Prelude hiding ((-),(+),(*),negate,subtract, fromInteger) instance Distinguished QuaternionBasis' where
Numeric/Covector.hs view
@@ -22,7 +22,6 @@ import Numeric.Algebra.Involutive import Numeric.Algebra.Commutative import Numeric.Algebra.Hopf-import Numeric.Module.Class import Numeric.Rig.Class import Numeric.Ring.Class import Control.Applicative
Numeric/Map.hs view
@@ -28,7 +28,7 @@ import Control.Monad.Reader.Class import Data.Key import Data.Functor.Representable-import Data.Functor.Representable.Trie +import Data.Functor.Representable.Trie import Data.Functor.Bind import Data.Functor.Plus hiding (zero) import qualified Data.Functor.Plus as Plus@@ -44,7 +44,7 @@ -- -- -- @Map r b a@ represents a linear mapping from a free module with basis @a@ over @r@ to a free module with basis @b@ over @r@.--- +-- -- Note well the reversed direction of the arrow, due to the contravariance of change of basis! -- -- This way enables we can employ arbitrary pure functions as linear maps by lifting them using `arr`, or build them@@ -81,24 +81,18 @@ instance Bind (Map r b) where Map m >>- f = Map $ \k b -> m (\a -> (f a $# k) b) b- + instance Monad (Map r b) where return a = Map $ \k _ -> k a m >>= f = Map $ \k b -> (m $# \a -> (f a $# k) b) b -instance PFunctor (,) (Map r) (Map r) where- first m = Map $ \k (a,c) -> (m $# \b -> k (b,c)) a--instance QFunctor (,) (Map r) (Map r) where- second m = Map $ \k (c,a) -> (m $# \b -> k (c,b)) a-+instance PFunctor (,) (Map r) (Map r)+instance QFunctor (,) (Map r) (Map r) instance Bifunctor (,) (Map r) (Map r) (Map r) where bimap m n = Map $ \k (a,c) -> (m $# \b -> (n $# \d -> k (b,d)) c) a instance Associative (Map r) (,) where associate = arr associate--instance Disassociative (Map r) (,) where disassociate = arr disassociate instance Braided (Map r) (,) where@@ -106,25 +100,22 @@ instance Symmetric (Map r) (,) -type instance Id (Map r) (,) = ()- instance C.Monoidal (Map r) (,) where+ type Id (Map r) (,) = () idl = arr C.idl idr = arr C.idr--instance C.Comonoidal (Map r) (,) where coidl = arr C.coidl coidr = arr C.coidr -instance PreCartesian (Map r) where- type Product (Map r) = (,) +instance Cartesian (Map r) where+ type Product (Map r) = (,) fst = arr fst snd = arr snd diag = arr diag f &&& g = Map $ \k a -> (f $# \b -> (g $# \c -> k (b,c)) a) a instance CCC (Map r) where- type Exp (Map r) = Map r + type Exp (Map r) = Map r apply = Map $ \k (f,a) -> (f $# k) a curry m = Map $ \k a -> k (Map $ \k' b -> (m $# k') (a, b)) uncurry m = Map $ \k (a, b) -> (m $# (\m' -> (m' $# k) b)) a@@ -132,19 +123,13 @@ instance Distributive (Map r) where distribute = Map $ \k (a,p) -> k $ bimap ((,) a) ((,)a) p -instance PFunctor Either (Map r) (Map r) where- first m = Map $ \k -> either (m $# k . Left) (k . Right)--instance QFunctor Either (Map r) (Map r) where- second m = Map $ \k -> either (k . Left) (m $# k . Right)-+instance PFunctor Either (Map r) (Map r)+instance QFunctor Either (Map r) (Map r) instance Bifunctor Either (Map r) (Map r) (Map r) where bimap m n = Map $ \k -> either (m $# k . Left) (n $# k . Right) instance Associative (Map r) Either where associate = arr associate--instance Disassociative (Map r) Either where disassociate = arr disassociate instance Braided (Map r) Either where@@ -152,22 +137,19 @@ instance Symmetric (Map r) Either -type instance Id (Map r) Either = Void--instance PreCoCartesian (Map r) where+instance CoCartesian (Map r) where type Sum (Map r) = Either- inl = arr inl + inl = arr inl inr = arr inr codiag = arr codiag- m ||| n = Map $ \k -> either (m $# k) (n $# k) --instance C.Comonoidal (Map r) Either where- coidl = arr C.coidl- coidr = arr C.coidr+ m ||| n = Map $ \k -> either (m $# k) (n $# k) instance C.Monoidal (Map r) Either where+ type Id (Map r) Either = Void idl = arr C.idl idr = arr C.idr+ coidl = arr C.coidl+ coidr = arr C.coidr instance Arrow (Map r) where arr f = Map (. f)@@ -190,7 +172,7 @@ -- callCC f = Map $ \k -> (f $# \a -> Map $ \_ _ -> k a) k -- label :: ((a -> r) -> Map r b a) -> Map r b a--- label f = Map $ \k -> f k $# k +-- label f = Map $ \k -> f k $# k -- break :: (a -> r) -> a -> Map r b a @@ -204,7 +186,7 @@ left m = Map $ \k -> either (m $# k . Left) (k . Right) right m = Map $ \k -> either (k . Left) (m $# k . Right) m +++ n = Map $ \k -> either (m $# k . Left) (n $# k . Right)- m ||| n = Map $ \k -> either (m $# k) (n $# k) + m ||| n = Map $ \k -> either (m $# k) (n $# k) -- TODO: ArrowLoop? @@ -221,7 +203,7 @@ instance Coalgebra r m => Semiring (Map r b m) -instance Coalgebra r m => LeftModule (Map r b m) (Map r b m) where +instance Coalgebra r m => LeftModule (Map r b m) (Map r b m) where (.*) = (*) instance LeftModule r s => LeftModule r (Map s b m) where@@ -235,7 +217,7 @@ Map m <!> Map n = Map $ m + n instance Monoidal r => Plus (Map r b) where- zero = Map zero + zero = Map zero instance Monoidal r => Alternative (Map r b) where Map m <|> Map n = Map $ m + n@@ -299,7 +281,7 @@ {- -- ring homomorphism from r -> r^a-embedMap :: (Unital m, CounitalCoalgebra r m) => (b -> r) -> Map r b m +embedMap :: (Unital m, CounitalCoalgebra r m) => (b -> r) -> Map r b m embedMap f = Map $ \k b -> f b * k one -- if the characteristic of s does not divide the order of a, then s[a] is semisimple
algebra.cabal view
@@ -1,6 +1,6 @@ name: algebra category: Math, Algebra-version: 2.0.7+version: 2.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -38,7 +38,7 @@ distributive >= 0.2 && < 0.3, transformers >= 0.2 && < 0.3, tagged >= 0.2.2.3 && < 0.3,- categories >= 0.59 && < 0.60,+ categories >= 1.0 && < 1.1, containers >= 0.3 && < 0.5, keys >= 2.1.2 && < 2.2, mtl >= 2 && < 2.1,