FGL problem: cannot acces data constructor NodeMap

Hi, I have a problem with the data constructor NodeMap Data.Graph.Inductive.NodeMap of the graph library fgl-5.4.2.3 (also fgl-5.4.2.2): I cannot access the data constructor NodeMap, as the ghci session shows: Prelude> :m Data.Graph.Inductive.NodeMap Prelude Data.Graph.Inductive.NodeMap> :t NodeMap <interactive>:1:0: Not in scope: data constructor `NodeMap' However, when I load the source directly it works: Prelude> :l Data/Graph/Inductive/NodeMap.hs [1 of 3] Compiling Data.Graph.Inductive.Graph ( Data/Graph/Inductive/Graph.hs, interpreted ) [2 of 3] Compiling Data.Graph.Inductive.Internal.FiniteMap ( Data/Graph/Inductive/Internal/FiniteMap.hs, interpreted ) [3 of 3] Compiling Data.Graph.Inductive.NodeMap ( Data/Graph/Inductive/NodeMap.hs, interpreted ) Ok, modules loaded: Data.Graph.Inductive.Internal.FiniteMap, Data.Graph.Inductive.Graph, Data.Graph.Inductive.NodeMap. *Data.Graph.Inductive.NodeMap> :t NodeMap NodeMap :: (Ord a) => FiniteMap a Node -> Int -> NodeMap a Why is that so? Afterall, my purpose is to get access to the map in a NodeMap and finally to apply lookup to it. But I don't know how to access the map from a NodeMap (the map selector isn't accessible either). Immanuel

Immanuel Normann
Hi,
I have a problem with the data constructor NodeMap Data.Graph.Inductive.NodeMap of the graph library fgl-5.4.2.3 (also fgl-5.4.2.2):
I cannot access the data constructor NodeMap, as the ghci session shows:
Prelude> :m Data.Graph.Inductive.NodeMap Prelude Data.Graph.Inductive.NodeMap> :t NodeMap
<interactive>:1:0: Not in scope: data constructor `NodeMap'
Well, yes, because you're not meant to.
However, when I load the source directly it works:
Prelude> :l Data/Graph/Inductive/NodeMap.hs [1 of 3] Compiling Data.Graph.Inductive.Graph ( Data/Graph/Inductive/Graph.hs, interpreted ) [2 of 3] Compiling Data.Graph.Inductive.Internal.FiniteMap ( Data/Graph/Inductive/Internal/FiniteMap.hs, interpreted ) [3 of 3] Compiling Data.Graph.Inductive.NodeMap ( Data/Graph/Inductive/NodeMap.hs, interpreted ) Ok, modules loaded: Data.Graph.Inductive.Internal.FiniteMap, Data.Graph.Inductive.Graph, Data.Graph.Inductive.NodeMap. *Data.Graph.Inductive.NodeMap> :t NodeMap NodeMap :: (Ord a) => FiniteMap a Node -> Int -> NodeMap a
Why is that so?
This works because you're using ghci from within the module, whereas when you import it you're using only its exposed API.
Afterall, my purpose is to get access to the map in a NodeMap and finally to apply lookup to it. But I don't know how to access the map from a NodeMap (the map selector isn't accessible either).
You're not meant to; the point of NodeMap is to serve as a wrapper around the normal graph types, not for you to use directly (exactly the same as why the constructor for Map isn't exported). May I ask, however, why you want to use Data.Graph.Inductive.NodeMap? -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com
participants (2)
-
Immanuel Normann
-
Ivan Lazar Miljenovic