packages feed

FiniteCategories 0.6.0.1 → 0.6.0.2

raw patch · 3 files changed

+12/−2 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Math.Categories.FunctorCategory: instance (GHC.Classes.Eq c1, GHC.Classes.Eq c2, GHC.Classes.Eq o1, GHC.Classes.Eq m1) => GHC.Classes.Eq (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
- Math.Categories.FunctorCategory: instance (GHC.Classes.Eq o1, Data.Simplifiable.Simplifiable c1, Data.Simplifiable.Simplifiable c2, Data.Simplifiable.Simplifiable o1, Data.Simplifiable.Simplifiable m1) => Data.Simplifiable.Simplifiable (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
- Math.Categories.FunctorCategory: instance (GHC.Classes.Eq o1, Math.IO.PrettyPrint.PrettyPrint c1, Math.IO.PrettyPrint.PrettyPrint c2, Math.IO.PrettyPrint.PrettyPrint o1, Math.IO.PrettyPrint.PrettyPrint m1) => Math.IO.PrettyPrint.PrettyPrint (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
- Math.Categories.FunctorCategory: instance (GHC.Show.Show c1, GHC.Show.Show c2, GHC.Show.Show o1, GHC.Show.Show m1) => GHC.Show.Show (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
+ Math.Categories.FunctorCategory: instance (GHC.Classes.Eq c1, GHC.Classes.Eq c2, GHC.Classes.Eq m2, GHC.Classes.Eq o1, GHC.Classes.Eq m1) => GHC.Classes.Eq (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
+ Math.Categories.FunctorCategory: instance (GHC.Classes.Eq o1, Data.Simplifiable.Simplifiable c1, Data.Simplifiable.Simplifiable c2, Data.Simplifiable.Simplifiable m2, Data.Simplifiable.Simplifiable o1, Data.Simplifiable.Simplifiable m1) => Data.Simplifiable.Simplifiable (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
+ Math.Categories.FunctorCategory: instance (GHC.Classes.Eq o1, Math.IO.PrettyPrint.PrettyPrint c1, Math.IO.PrettyPrint.PrettyPrint c2, Math.IO.PrettyPrint.PrettyPrint m2, Math.IO.PrettyPrint.PrettyPrint o1, Math.IO.PrettyPrint.PrettyPrint m1) => Math.IO.PrettyPrint.PrettyPrint (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)
+ Math.Categories.FunctorCategory: instance (GHC.Show.Show c1, GHC.Show.Show c2, GHC.Show.Show m2, GHC.Show.Show o1, GHC.Show.Show m1) => GHC.Show.Show (Math.Categories.FunctorCategory.NaturalTransformationError c1 m1 o1 c2 m2 o2)

Files

CHANGELOG.md view
@@ -30,4 +30,8 @@ 
 ## 0.6.0.1 -- 2024-01-14
 
-* Correct bug in completeDiagram.+* Correct bug in completeDiagram.
+
+## 0.6.0.2 -- 2024-01-22
+
+* Bug fix in checkNaturalTransformation.
FiniteCategories.cabal view
@@ -14,7 +14,7 @@ -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:            0.6.0.1
+version:            0.6.0.2
 
 -- A short (one-line) description of the package.
 synopsis: Finite categories and usual categorical constructions on them.
src/Math/Categories/FunctorCategory.hs view
@@ -376,6 +376,8 @@     -- | A datatype to represent a malformation of a 'NaturalTransformation'.
     data NaturalTransformationError c1 m1 o1 c2 m2 o2 = IncompatibleFunctorsSource{sourceCat :: c1, targetCat :: c1} -- ^ The source and target functors don't have the same source category.
                                                       | IncompatibleFunctorsTarget{sourceCat2 :: c2, targetCat2 :: c2} -- ^ The source and target functors don't have the same target category.
+                                                      | WrongComponentSource{faultyComponent1 :: m2, correctSource :: o1} -- ^ The source of a component is not the image of the indexing object by the source functor. 
+                                                      | WrongComponentTarget{faultyComponent2 :: m2, correctTarget :: o1} -- ^ The target of a component is not the image of the indexing object by the target functor. 
                                                       | NotTotal{domainNat :: Set o1, objectsCat :: Set o1} -- ^ The mapping from objects to morphisms is not total.
                                                       | NaturalityFail{originalMorphism :: m1} -- ^ A morphism does not close a commutative square.
                                                       deriving (Eq, Show, Generic, PrettyPrint, Simplifiable)
@@ -389,12 +391,16 @@         | incompatibleFunctorsSource = Just IncompatibleFunctorsSource{sourceCat=(src.source $ nt), targetCat=(src.target $ nt)}
         | incompatibleFunctorsTarget = Just IncompatibleFunctorsTarget{sourceCat2=(tgt.source $ nt), targetCat2=(tgt.target $ nt)}
         | notTotal = Just NotTotal{domainNat = (domain.components $ nt), objectsCat = (ob.src.source $ nt)}
+        | (not.(Set.null)) wrongSource = Just WrongComponentSource{faultyComponent1 = fst $ anElement wrongSource, correctSource = snd $ anElement wrongSource}
+        | (not.(Set.null)) wrongTarget = Just WrongComponentTarget{faultyComponent2 = fst $ anElement wrongTarget, correctTarget = snd $ anElement wrongTarget}
         | (not.(Set.null)) naturalityFail = Just NaturalityFail{originalMorphism = anElement naturalityFail}
         | otherwise = Nothing
         where
             incompatibleFunctorsSource = (src.source $ nt) /= (src.target $ nt)
             incompatibleFunctorsTarget = (tgt.source $ nt) /= (tgt.target $ nt)  
             notTotal = (domain.components $ nt) /= (ob.src.source $ nt)
+            wrongSource = [((nt =>$ i),i) | i <- (ob.src.source $ nt), (source nt) ->$ i /= source (nt =>$ i)]
+            wrongTarget = [((nt =>$ i),i) | i <- (ob.src.source $ nt), (target nt) ->$ i /= target (nt =>$ i)]
             naturalityFail = [f | f <- (arrows.src.source $ nt), (target nt ->£ f) @ (nt =>$ (source f)) /= (nt =>$ (target f)) @ (source nt ->£ f)]
     
     -- | The smart constructor of 'NaturalTransformation'. Checks wether the structure is correct.