greskell 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+15/−7 lines, 3 filesdep ~basedep ~doctestPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, doctest
API changes (from Hackage documentation)
+ Data.Greskell.Graph: instance Data.Semigroup.Semigroup (Data.Greskell.Graph.PropertyMapList p v)
+ Data.Greskell.Graph: instance Data.Semigroup.Semigroup (Data.Greskell.Graph.PropertyMapSingle p v)
+ Data.Greskell.Graph: instance Data.Semigroup.Semigroup (t (p v)) => Data.Semigroup.Semigroup (Data.Greskell.Graph.PropertyMapGeneric t p v)
Files
- ChangeLog.md +6/−0
- greskell.cabal +3/−3
- src/Data/Greskell/Graph.hs +6/−4
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for greskell +## 0.1.1.0 -- 2018-04-08++* Add Semigroup instance to PropertyMapSingle and PropertyMapList.+* Confirmed test with base-4.11 (with hint-test and server-test disabled)++ ## 0.1.0.0 -- 2018-03-12 * First version. Released on an unsuspecting world.
greskell.cabal view
@@ -1,5 +1,5 @@ name: greskell-version: 0.1.0.0+version: 0.1.1.0 author: Toshio Ito <debug.ito@gmail.com> maintainer: Toshio Ito <debug.ito@gmail.com> license: BSD3@@ -32,7 +32,7 @@ Data.Greskell.Graph, Data.Greskell.GTraversal -- other-modules: - build-depends: base >=4.9.0.0 && <4.11,+ build-depends: base >=4.9.0.0 && <4.12, greskell-core >=0.1.0.0 && <0.2, text >=1.2.2.1 && <1.3, transformers >=0.5.2 && <0.6,@@ -64,7 +64,7 @@ ghc-options: -Wall -fno-warn-unused-imports "-with-rtsopts=-M512m" main-is: DocTest.hs build-depends: base,- doctest >=0.11 && <0.15,+ doctest >=0.11 && <0.16, doctest-discover >=0.1.0.8 && <0.2
src/Data/Greskell/Graph.hs view
@@ -393,10 +393,12 @@ newtype PropertyMapGeneric t p v = PropertyMapGeneric (HM.HashMap Text (t (p v))) deriving (Show,Eq) +instance Semigroup (t (p v)) => Semigroup (PropertyMapGeneric t p v) where+ (PropertyMapGeneric a) <> (PropertyMapGeneric b) = PropertyMapGeneric $ HM.unionWith (<>) a b+ instance Semigroup (t (p v)) => Monoid (PropertyMapGeneric t p v) where mempty = PropertyMapGeneric mempty- mappend (PropertyMapGeneric a) (PropertyMapGeneric b) =- PropertyMapGeneric $ HM.unionWith (<>) a b+ mappend = (<>) instance (Functor t, Functor p) => Functor (PropertyMapGeneric t p) where fmap f (PropertyMapGeneric hm) = PropertyMapGeneric $ (fmap . fmap . fmap) f hm@@ -442,7 +444,7 @@ -- property maps share some same keys, the value from the left map -- wins. newtype PropertyMapSingle p v = PropertyMapSingle (PropertyMapGeneric Semigroup.First p v)- deriving (Show,Eq,Monoid,Functor,Foldable,Traversable)+ deriving (Show,Eq,Semigroup,Monoid,Functor,Foldable,Traversable) instance PropertyMap PropertyMapSingle where lookupOne k (PropertyMapSingle (PropertyMapGeneric hm)) = fmap Semigroup.getFirst $ HM.lookup k hm@@ -466,7 +468,7 @@ -- property maps share some same keys, those property lists are -- concatenated. newtype PropertyMapList p v = PropertyMapList (PropertyMapGeneric NonEmpty p v)- deriving (Show,Eq,Monoid,Functor,Foldable,Traversable)+ deriving (Show,Eq,Semigroup,Monoid,Functor,Foldable,Traversable) instance PropertyMap PropertyMapList where lookupList k (PropertyMapList (PropertyMapGeneric hm)) = maybe [] NL.toList $ HM.lookup k hm