functional "updatable" graph

Hal Daume t-hald@microsoft.com
Sun, 13 Jul 2003 11:45:06 -0700


>> I think that the
>> difficulties you are
>> facing are from the fact that you are trying to
>> express a purely
>> functional "updatable" graph.
>=20
> Should I understand from this, that this is a
> difficult problem and that there exist no easy way to
> do this at the moment?

Well, I think he was being a bit ironic.  You can either have a
functional graph or an updatable graph, but not both.  It sounds like
either would do and given that later in this message you discuss that
you don't like imperativeness, then a functional graph (ala the
Functional Graph Library -- FGL) would suit you perfectly.

> About the graphs:Well, I never had graphs at school
> yet(first year student)... Although it is somewhere in
> my textbooks...

They're very simple.  You have a collection of nodes, N, and a
collection of edges between elements of N.  Nodes and edges can have
labels.  So for instance you could have Teachers and Classes as the
nodes and the edges could be between the teacher and the class(es) which
go together.

> To solve my problem... I need an mutable array, but in
> Haskell my program will then be unbelievable
> imperative.=20

No, you just need a graph :).

> I have been following the discussion about the graph
> and so, but the arrow classes and so on, are like
> something too sophisticated for me at this moment I
> think, although I have some idea of how they work, I
> really don't know when to apply them. I just found
> out, how Monads work, so...

THe discussion about arrows is a complete divergence.  You don't need
anything about them.

> But I certainly believe that my problem must be fixed
> before it's easy to program in Haskell.

Theorem: this problem is already fixed.
Proof: it is easy to program in Haskell.  QED.

:)

 - Hal