[Haskell-cafe] Re: What do _you_ want to see in FGL?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Mon May 17 05:06:33 EDT 2010


Heinrich Apfelmus <apfelmus at quantentunnel.de> writes:

> Ivan Lazar Miljenovic wrote:
>> Heinrich Apfelmus writes:
>>>
>>> I was under the impression that I would have to define a new graph data
>>> type with  FilePath  as vertex type and make that an instance of  Graph
>>> ? [..]
>> 
>> Well, we'll provide a Map-based one that lets you specify the vertex
>> type as a type parameter; this functionality (type parameter being ued
>> for the vertex type) won't be required since not all graphs will be able
>> to chop and choose which vertex type to use.
>
> Ah, that would indeed make it easy. Maybe make the map based graph
> generic, so that it can be used with any primitive graph implementation?
>
>    data VertexGraph node gr a b = VG (gr a b) (BiMap node (Vertex gr))
>
>    instance (Ord node, Graph gr) => Graph VertexGraph node gr where

Not sure I understand what the point of the `gr' is there; what I meant
was something like:

    newtype MapGraph node a b = MG (Map node (Map node b, a, Map node b))

>> Well, you can consider the current Int vertex type to be a (not-so-)
>> abstract vertex type; it might be an idea to wrap this up so people
>> don't mess with it themselves though.
>
> That would be much appreciated. :)

We'll consider this then.  (*sigh* it's not enough that we're
modernising this library, but we also have to hold the users hand for
them in case they accidentally use the wrong Int?  Gimme a break! :p)

Actually, this might solve a problem that Thomas and I were discussing
earlier where a Context can refer to vertices not in the graph (it won't
completely remove the problem as you can still get the value from a
different state of the graph, but will help remove obvious user error
when manually constructing Context values).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list