[Haskell-cafe] functional graphs
Christian Maeder
Christian.Maeder at dfki.de
Fri Jan 18 07:55:14 EST 2008
Hi,
Given a complete graph as a list of nodes whose edge labels are given by
a function over two nodes:
data CGraph a b = CGraph [a] (a -> a -> b)
Can I define an instance for the fgl Graph class?
import Data.Graph.Inductive.Graph
instance Graph CGraph where
empty = CGraph [] -- and now?
I had no idea how to define empty (except using undefined).
I thought of requiring a context for the node labels of type a, but this
type is not mentioned in the class header. So it looked to me like the
impossibility to define sets (requiring an Ord) as monads. (i.e.
instance Monad Data.Set.Set)
Any working proposals for my graph problem?
Cheers Christian
More information about the Haskell-Cafe
mailing list