Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-fgl for openSUSE:Factory checked 
in at 2024-10-28 15:18:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-fgl (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-fgl.new.2020 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-fgl"

Mon Oct 28 15:18:34 2024 rev:10 rq:1218555 version:5.8.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-fgl/ghc-fgl.changes  2023-11-23 
21:41:53.498239367 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-fgl.new.2020/ghc-fgl.changes        
2024-10-28 15:20:35.544130971 +0100
@@ -1,0 +2,11 @@
+Mon Sep 30 06:53:01 UTC 2024 - Peter Simons <[email protected]>
+
+- Update fgl to version 5.8.3.0.
+  5.8.3.0
+  -------
+
+  * Data.Graph.Inductive.NodeMap now has functions mkLookupNode,
+    insMapLookupNode, memberNode, and lookupNode for detecting whether a
+    graph already contains a node (issue #72, PR #77).
+
+-------------------------------------------------------------------

Old:
----
  fgl-5.8.2.0.tar.gz

New:
----
  fgl-5.8.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-fgl.spec ++++++
--- /var/tmp/diff_new_pack.aQ81ST/_old  2024-10-28 15:20:36.324163456 +0100
+++ /var/tmp/diff_new_pack.aQ81ST/_new  2024-10-28 15:20:36.324163456 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-fgl
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 %global pkgver %{pkg_name}-%{version}
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        5.8.2.0
+Version:        5.8.3.0
 Release:        0
 Summary:        Martin Erwig's Functional Graph Library
 License:        BSD-3-Clause

++++++ fgl-5.8.2.0.tar.gz -> fgl-5.8.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fgl-5.8.2.0/ChangeLog new/fgl-5.8.3.0/ChangeLog
--- old/fgl-5.8.2.0/ChangeLog   2001-09-09 03:46:40.000000000 +0200
+++ new/fgl-5.8.3.0/ChangeLog   2001-09-09 03:46:40.000000000 +0200
@@ -1,3 +1,10 @@
+5.8.3.0
+-------
+
+* Data.Graph.Inductive.NodeMap now has functions mkLookupNode,
+  insMapLookupNode, memberNode, and lookupNode for detecting whether a
+  graph already contains a node (issue #72, PR #77).
+
 5.8.2.0
 -------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fgl-5.8.2.0/Data/Graph/Inductive/NodeMap.hs 
new/fgl-5.8.3.0/Data/Graph/Inductive/NodeMap.hs
--- old/fgl-5.8.2.0/Data/Graph/Inductive/NodeMap.hs     2001-09-09 
03:46:40.000000000 +0200
+++ new/fgl-5.8.3.0/Data/Graph/Inductive/NodeMap.hs     2001-09-09 
03:46:40.000000000 +0200
@@ -6,13 +6,13 @@
     -- * Functional Construction
     NodeMap,
     -- ** Map Construction
-    new, fromGraph, mkNode, mkNode_, mkNodes, mkNodes_, mkEdge, mkEdges,
+    new, fromGraph, mkNode, mkNode_, mkNodes, mkLookupNode, mkNodes_, mkEdge, 
mkEdges,
     -- ** Graph Construction
     -- | These functions mirror the construction and destruction functions in
     -- 'Data.Graph.Inductive.Graph', but use the given 'NodeMap' to look up
     -- the appropriate 'Node's.  Note that the 'insMapNode' family of functions
     -- will create new nodes as needed, but the other functions will not.
-    insMapNode, insMapNode_, insMapEdge, delMapNode, delMapEdge, insMapNodes,
+    insMapNode, insMapLookupNode, insMapNode_, insMapEdge, delMapNode, 
delMapEdge, insMapNodes,
     insMapNodes_, insMapEdges, delMapNodes, delMapEdges, mkMapGraph,
     -- * Monadic Construction
     NodeMapM,
@@ -23,7 +23,10 @@
     run, run_, mkNodeM, mkNodesM, mkEdgeM, mkEdgesM,
     -- ** Graph Construction
     insMapNodeM, insMapEdgeM, delMapNodeM, delMapEdgeM, insMapNodesM,
-    insMapEdgesM, delMapNodesM, delMapEdgesM
+    insMapEdgesM, delMapNodesM, delMapEdgesM,
+
+    -- ** Map inspection
+    memberNode, lookupNode
 ) where
 
 import           Control.Monad.Trans.State
@@ -62,15 +65,30 @@
         (m, k) = foldr aux (M.empty, 0) ns
     in NodeMap { map = m, key = k+1 }
 
+-- | Is the node in the map ?
+memberNode :: (Ord a) => a -> NodeMap a -> Bool
+memberNode a = M.member a . map
+
+-- | Lookup for the node in the map.
+lookupNode :: (Ord a) => a -> NodeMap a -> Maybe Node
+lookupNode a = M.lookup a . map
+
 -- | Generate a labelled node from the given label.  Will return the same node
 -- for the same label.
 mkNode :: (Ord a) => NodeMap a -> a -> (LNode a, NodeMap a)
-mkNode m@(NodeMap mp k) a =
+mkNode m = forgetFst . mkLookupNode m
+  where
+    forgetFst (_,x,y)=(x,y)
+
+-- | Act as 'mkNode', but return also a boolean set as @True@ if the node was
+-- already in the map.
+mkLookupNode :: (Ord a) => NodeMap a -> a -> (Bool, LNode a, NodeMap a)
+mkLookupNode m@(NodeMap mp k) a =
     case M.lookup a mp of
-        Just i        -> ((i, a), m)
-        Nothing        ->
+        Just i        -> (True,(i, a), m)
+        Nothing       ->
             let m' = NodeMap { map = M.insert a k mp, key = k+1 }
-            in ((k, a), m')
+            in (False,(k, a), m')
 
 -- | Generate a labelled node and throw away the modified 'NodeMap'.
 mkNode_ :: (Ord a) => NodeMap a -> a -> LNode a
@@ -107,6 +125,13 @@
     let (n, m') = mkNode m a
     in (insNode n g, m', n)
 
+-- | Act as 'insMapNode', but return also a boolean set as @True@ if the node 
was
+-- already in the map.
+insMapLookupNode :: (Ord a, DynGraph g) => NodeMap a -> a -> g a b -> (Bool, g 
a b, NodeMap a, LNode a)
+insMapLookupNode m a g =
+    let (b, n, m') = mkLookupNode m a
+    in (b, insNode n g, m', n)
+
 insMapNode_ :: (Ord a, DynGraph g) => NodeMap a -> a -> g a b -> g a b
 insMapNode_ m a g =
     let (g', _, _) = insMapNode m a g
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fgl-5.8.2.0/fgl.cabal new/fgl-5.8.3.0/fgl.cabal
--- old/fgl-5.8.2.0/fgl.cabal   2001-09-09 03:46:40.000000000 +0200
+++ new/fgl-5.8.3.0/fgl.cabal   2001-09-09 03:46:40.000000000 +0200
@@ -1,5 +1,5 @@
 name:          fgl
-version:       5.8.2.0
+version:       5.8.3.0
 license:       BSD3
 license-file:  LICENSE
 author:        Martin Erwig, Ivan Lazar Miljenovic

Reply via email to