On 25 November 2011 05:13, Thomas DuBuisson <[email protected]> wrote: > My thinking on this was that something akin to NodeMap should be > _part_ of the graph structure. This would be more convenient and > allow the graph and nodemap operations to apply to a single data > structure. > > Instead of: > > insMapNode_ :: (Ord a, DynGraph g) => NodeMap a -> a -> g a b -> g a b > > You could have: > > insMapNode_ :: (Ord a, DynGraph g) => a -> g a b -> g a b > > The only think stopping us from making a product data type like this > is the inflexibility of the type classes, right? Were we able to > define (&) to update the nodemap too then we could keep these to > structures in sync automatically instead of expecting the programmer > to keep them paired correctly.
My thinking is to (eventually) make more fine-grained classes, and have newtype wrappers that would add this kind of functionality (which would even let you choose the type of constraint); i.e. adding a node to a `(Hashable (NodeLabel g)) => HashableNodeMap g` would also add a `NodeLabel g -> Node g` mapping to some internal lookup; is this what you're after? -- Ivan Lazar Miljenovic [email protected] IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
